id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
178218 | from .l2_loss import L2Loss
__all__ = ['L2Loss']
| StarcoderdataPython |
3360279 | import copy
import random
import numpy as np
class NPuzzle:
"""N-Puzzle simulator"""
def __init__(self, n=15, start_blank=None):
self.n = int(n)
self.width = int(np.round(np.sqrt(n+1)))
assert self.width**2-1 == self.n
self.state = np.arange(self.n+1).reshape(self.width, self.... | StarcoderdataPython |
172355 | """
time: n^3
space: n
"""
class Solution:
def wordBreak(self, s: str, wordDict: List[str]) -> bool:
dp = [True] + [False] * len(s)
for i in range(1, len(s)+1):
for w in wordDict:
if s[:i].endswith(w):
dp[i] |= dp[i-len(w)]
return dp[-1]
"""
t... | StarcoderdataPython |
1706149 | from home.models import task, task_steps,resource,server
from home.config import test_type
from datetime import datetime
def find_resource(name,target):
for i in range(len(target)):
if target[i]['name'] == name:
return i
return -1
def get_resources(resource_type=0):
resource_list = reso... | StarcoderdataPython |
20404 | """Competitions for parameter tuning using Monte-carlo tree search."""
from __future__ import division
import operator
import random
from heapq import nlargest
from math import exp, log, sqrt
from gomill import compact_tracebacks
from gomill import game_jobs
from gomill import competitions
from gomill import competi... | StarcoderdataPython |
3239977 | #
# Init
#
# import global modules
import configparser
import importlib
def init():
global config
config = configparser.ConfigParser()
config.read('config.ini')
global commands
commands = {}
def addCommandAction(command, instance, function):
if command in commands.keys():
commands[co... | StarcoderdataPython |
1737211 | #
# Copyright 2016 Quantopian, 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... | StarcoderdataPython |
24692 | <gh_stars>0
import sys
import copy
def find_available(graph, steps):
return [s for s in steps if s not in graph]
def trim_graph(graph, item):
removed_keys = []
for step, items in graph.items():
if item in items:
items.remove(item)
if len(items) == 0:
remov... | StarcoderdataPython |
3249760 | <filename>deepsim/deepsim/core/material.py
#################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache L... | StarcoderdataPython |
68345 | from pypdnsrest.dnsrecords import DNSMxRecord
from pypdnsrest.dnsrecords import DNSMxRecordData
from pypdnsrest.dnsrecords import InvalidDNSRecordException
from datetime import timedelta
from tests.records.test_records import TestRecords
class TestMxRecord(TestRecords):
def test_record(self):
mxdata = DNS... | StarcoderdataPython |
54070 | <reponame>Berailitz/library_monitor
"""Monitor book state in BUPT's library, send notice if available."""
import json
import logging
from typing import List, Dict
import requests
from .config import BOOK_PAGE_REFERER, BOOK_STATE_API, DAILY_REPORT_TEMPLATE, MESSAGE_TEMPLATE, NOTICE_COUNTER, TARGET_STATE
from .models im... | StarcoderdataPython |
1702771 | import os
import shutil
import tempfile
from lms import notifications
from lms.lmsdb import models
from lms.lmstests.public.flake8 import tasks
INVALID_CODE = 'print "Hello Word" '
INVALID_CODE_MESSAGE = 'כשהבודק שלנו ניסה להריץ את הקוד שלך, הוא ראה שלפייתון יש בעיה להבין אותו. כדאי לוודא שהקוד רץ כהלכה לפני שמגישים ... | StarcoderdataPython |
143795 | <filename>mavsim_python/parameters/planner_parameters.py
import sys
sys.path.append('..')
import numpy as np
import parameters.aerosonde_parameters as MAV
# size of the waypoint array used for the path planner. This is the
# maximum number of waypoints that might be transmitted to the path
# manager.
size_waypoint_ar... | StarcoderdataPython |
37221 | <gh_stars>0
# Python
# Django
# Try Django
# Getting Started (Level 1)
# Challenge 03 - Refactor the existing URL Dispatchers
from django.conf.urls import url
from . import views
urlpatterns = [
# TODO: Add a url() object whose regex parameter takes an empty path that
# terminates, and goes to views.ho... | StarcoderdataPython |
1767633 | <filename>server/app.py
from s3 import app
from s3.api import *
if __name__ == '__main__':
app.run(host='localhost', port=5000, debug=True) | StarcoderdataPython |
1698409 | <filename>main.py
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
id: int = None
price: float
name: str
description: str
deleted: bool = False
database = []
@app.get('/')
def index():
return {'hello': 'world'}
... | StarcoderdataPython |
1655616 | import logging
import sqlite3
import time
from datetime import date, datetime
from .indices import IndicesClient
logger = logging.getLogger("elasticsearch")
def _escape(value):
"""
Escape a single value of a URL string or a query parameter. If it is a list
or tuple, turn it into a comma-separated string... | StarcoderdataPython |
3372606 | from core.advbase import *
from slot.a import *
from slot.d import Leviathan
import adv.fjorm
def module():
return Fjorm
class Fjorm(adv.fjorm.Fjorm):
comment = '4x Fjorm in 20.55s with sufficient dprep'
a3 = [('prep',1.00), ('scharge_all', 0.05)]
a2 = [('dp',50)] # team dprep
conf = {}
conf['... | StarcoderdataPython |
78987 | <filename>homeassistant/components/denonavr/media_player.py
"""Support for Denon AVR receivers using their HTTP interface."""
import logging
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_MUSIC,
S... | StarcoderdataPython |
1603244 | #/************************************************************************************************************************
# Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modificat... | StarcoderdataPython |
3200260 | <filename>streamlit_files/utils.py
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import MinMaxScaler
from sklearn.base import BaseEstimator, TransformerMixin
import pandas as pd
#Replicando a classe Transformer para realizar pré-processamento das infos do cliente
class Transformer(BaseEsti... | StarcoderdataPython |
150993 | import socket
from django.conf import settings
from djutils.dashboard.provider import PanelProvider
from djutils.dashboard.registry import registry
try:
import psycopg2
except ImportError:
psycopg2 = None
def get_db_setting(key):
try:
return settings.DATABASES['default'][key]
except KeyError... | StarcoderdataPython |
137437 | <reponame>ji3g4m6zo6/JioNLP
# -*- coding=utf-8 -*-
# library: jionlp
# author: dongrixinyu
# license: Apache License 2.0
# Email: <EMAIL>
# github: https://github.com/dongrixinyu/JioNLP
# description: Preprocessing tool for Chinese NLP
from .extract_summary import ChineseSummaryExtractor
extract_summary = ChineseSu... | StarcoderdataPython |
4825686 | """
Structure for parsed as dict `:type:` or `:rtype:` nested lines.
"""
from typing import Iterable, List, Any
class TypeDocLine:
"""
Structure for parsed as dict `:type:` or `:rtype:` nested lines.
Arguments:
name -- Argument or TypedDict key name
type_name -- Argument or TypedDict key ... | StarcoderdataPython |
1657936 | import discord
from discord.ext import commands
import asyncio
import aiohttp
from datetime import datetime, timedelta
import random
import json
import re
# Owner only command
class Owner(commands.Cog):
"""Owner only commands."""
def __init__(self, bot):
self.bot = bot
self.color... | StarcoderdataPython |
3201820 | <reponame>serhankk/Kac-Sayfa
"""
Girilen yazar ve kitap adına göre
kitabın kaç sayfa olduğunu döndürür.
"""
import requests
import sys
from bs4 import BeautifulSoup
headers_param = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) \
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"}
p... | StarcoderdataPython |
3359765 | <reponame>brefra/python-plugwise
"""
Use of this source code is governed by the MIT license found in the LICENSE file.
Base for Plugwise messages
"""
from plugwise.constants import (
MESSAGE_FOOTER,
MESSAGE_HEADER,
UTF8_DECODE,
)
from plugwise.util import crc_fun
class ParserError(Exception):
"""
... | StarcoderdataPython |
3286585 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import numpy as np
import tensorflow as tf
from cleverhans.devtools.checks import CleverHansTest
from runner import RunnerMultiGPU
class TestRunnerMul... | StarcoderdataPython |
1768864 | <gh_stars>0
from sklearn.datasets import load_iris
from sklearn.tree import tree
from sklearn_porter import Porter
# Load data and train the classifier:
iris_data = load_iris()
X, y = iris_data.data, iris_data.target
clf = tree.DecisionTreeClassifier()
clf.fit(X, y)
# Export:
porter = Porter(clf, language='java')
out... | StarcoderdataPython |
3324581 | from .api import MojangAPI
from .user import MojangUser
| StarcoderdataPython |
3264952 | from pyspark.sql import SparkSession
class Extract:
"""
Functions to extract data from the source and return the spark dataframe.
"""
def __init__(self, spark, paths):
self.spark = spark
self.paths = paths
def _get_standard_csv(self, filepath, delimiter=","):
"""
... | StarcoderdataPython |
3386958 | <reponame>jugoodma/reu-2018
import sys
import boto3
import re
from xml.dom.minidom import parseString
import csv
from settings import *
mturk_environment = environments[mturk_type]
# users can pass in a profile as system argument
profile_name = sys.argv[1] if len(sys.argv) >= 2 else None
session = boto3.Session(profi... | StarcoderdataPython |
3222997 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import viewsets, filters
from edw.models.customer import CustomerModel
from edw.rest.serializers.customer import CustomerSerializer
from edw.rest.viewsets import remove_empty_params_from_request
class CustomerViewSet(viewsets.ReadOn... | StarcoderdataPython |
1778291 | # Copyright 2017 The Forseti Security 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
#
# Unless required by ap... | StarcoderdataPython |
3232514 | <filename>pytermcanvas/__init__.py
from .canvas import *
| StarcoderdataPython |
22834 | <filename>tests/unit/test_databeardb.py<gh_stars>1-10
'''
A unit test for databearDB.py
Runs manually at this point...
'''
import unittest
from databear.databearDB import DataBearDB
#Tests
class testDataBearDB(unittest.TestCase):
def setUp(self):
'''
Hmm
'''
pass
| StarcoderdataPython |
27952 | #!/usr/bin/env python
'''
Copyright (c) 2020 RIKEN
All Rights Reserved
See file LICENSE for details.
'''
import os,sys,datetime,multiprocessing
from os.path import abspath,dirname,realpath,join
import log,traceback
# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
def which(program):
... | StarcoderdataPython |
1678903 | <filename>src/datafinder/core/configuration/datastores/datastore.py
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification,... | StarcoderdataPython |
1725824 | #!/usr/bin/env python3
#
# Copyright 2018 Red Hat, Inc.
#
# Authors:
# <NAME> <<EMAIL>>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
from collections import OrderedDict
from django.contrib.auth.models import User
from django.http import Http... | StarcoderdataPython |
1616920 | <filename>part-2/5-context_managers/project-goal1.py<gh_stars>0
"""
Create a context manager that:
- input: file_name
_ outpur: a lazy iterator that iterate over the data file and yield the named tuple
"""
import csv
from collections import namedtuple
def get_dialect(fname):
with open(fname, 'r') as f:
sa... | StarcoderdataPython |
121127 | <filename>snapmerge/home/tests.py
from django.test import TestCase, RequestFactory
from django.test.client import Client
from django.db import models
from . import models
from . import views
# Create your tests here.
class TestProjectModel(TestCase):
def setUp(self):
# Every test needs access to the req... | StarcoderdataPython |
113190 | '''
Created on 2020-07-11
@author: wf
'''
import os
from ptp.titleparser import TitleParser
from ptp.event import EventManager, Event
class WikiData(object):
'''
WikiData proceedings titles event source
'''
defaultEndpoint="https://query.wikidata.org/sparql"
def __init__(self, config=None):
... | StarcoderdataPython |
3233634 | def num_special(mat):
ones_positions = [[row, col] for row in range(len(mat)) for col in range(len(mat[0])) if mat[row][col] == 1]
cols = [pos[1] for pos in ones_positions]
special_cols = [col for col in cols if cols.count(col) == 1]
special_count = 0
for pos in ones_positions:
row = pos[0]... | StarcoderdataPython |
3266925 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from . import config
from .http_client import HttpClient
from thrift.protocol.TCompactProtocol import TCompactProtocolAcceleratedFactory
from frugal.provider import FServiceProvider
from frugal.context import FContext
from .proto import LegyProtocolFactory
from .lib.Gen import f... | StarcoderdataPython |
3328123 | <reponame>sarkarghya/GSOC_org_analysis
import pickle as pk
import os
from datetime import date
from datetime import timedelta
def clean(stir):
return "".join(
[st for st in stir if not (st.isnumeric() or st.isspace() or st == ".")]
)
def defra(lisa):
n_lisa = []
for item in lisa:
n_l... | StarcoderdataPython |
139720 | #!/usr/bin/env python
from __future__ import print_function
from argparse import ArgumentParser
from androguard.cli import androlyze_main
from androguard.core.androconf import *
from androguard.misc import *
import os
import sql
import sqlstorehash
LIST_NAME_METHODS=["sendBroadcast", "onReceive","startService","onHan... | StarcoderdataPython |
1662249 | import glob
import pandas as pd
import numpy as np
import os
filenames = glob.glob("*.csv")
filenames = [filename for filename in filenames if os.path.getsize(filename) > 10000]
#filenames = ["CreditRequirement.csv"]
timestamp_col = "Complete Timestamp" # column that indicates completion timestamp
case_id_col = "Cas... | StarcoderdataPython |
3362222 | # Import the socket library.
import os
import socket
import threading
import configparser
import protocol
from time import sleep
class ChatClient:
MAX_MSG_LENGTH = 10
RECEIVE_SIZE = 1024
RECEIVE_INTERVAL = 0.1
SEND_INTERVAL = 0.5
def __init__(self, server_address, port):
"""
Start... | StarcoderdataPython |
4824115 | <gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. impor... | StarcoderdataPython |
3354744 | from django.shortcuts import render
import csv
from django.http import HttpResponse
from foundation.models import TimeSeriesDatum
def download_csv_report_01_temperature_sensor_api(request):
# Create the HttpResponse object with the appropriate CSV header.
data = TimeSeriesDatum.objects.filter(
senso... | StarcoderdataPython |
46955 | from django.db.models.signals import post_save
from django.dispatch import receiver
from company.models import Company
from company.tasks import deploy_new_company
@receiver(post_save, sender=Company)
def company_created(sender, instance, created, **kwargs):
if created:
deploy_new_company.delay(instance.... | StarcoderdataPython |
1781977 | import tkinter as tk
# sets root window object
window = tk.Tk()
# sets title
window.title("Manage My Life")
# sets default size of window
window.geometry("700x350")
# adds a widget to the GUI
greetingwidget = tk.Label(text="Greetings!")
greetingwidget.pack()
# blocks program, any code after here will not run. Conside... | StarcoderdataPython |
109919 | <reponame>Ryukyo/google-scrape
import csv
import functools
import os
import random
import time
import re
from multiprocessing import dummy
import requests
import urllib3
import uvicorn
from bs4 import BeautifulSoup
from fastapi import FastAPI, Request
from fastapi.middleware.trustedhost import TrustedHostMiddleware
fr... | StarcoderdataPython |
1787326 | <filename>tests/utils/molname_test.py
import pytest
from exojax.utils.molname import s2e_stable
def test_s2estable():
EXOMOL_SIMPLE2EXACT= \
{\
"CO":"12C-16O",\
"OH":"16O-1H",\
"NH3":"14N-1H3",\
"NO":"14N-16O",
"FeH":"56Fe-1H",
"H2S":"1H2-32S",
... | StarcoderdataPython |
137183 | import FWCore.ParameterSet.Config as cms
from Validation.HGCalValidation.simhitValidation_cff import *
from Validation.HGCalValidation.digiValidation_cff import *
from Validation.HGCalValidation.rechitValidation_cff import *
from Validation.HGCalValidation.hgcalHitValidation_cfi import *
from Validation.H... | StarcoderdataPython |
1719333 | <filename>pyzmq/examples/bench/xmlrpc_server.py<gh_stars>0
from SimpleXMLRPCServer import SimpleXMLRPCServer
def echo(x):
return x
server = SimpleXMLRPCServer(('localhost',10002))
server.register_function(echo)
server.serve_forever() | StarcoderdataPython |
14403 | <filename>setup.py
"""
Copyright 2016 Disney Connected and Advanced Technologies
Licensed under the Apache License, Version 2.0 (the "Apache License")
with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is ... | StarcoderdataPython |
1613131 | import copy
import itertools
import re
import threading
import html5lib
import requests
import urllib.parse
from bs4 import BeautifulSoup
from typing import List
try:
import basesite
except (ModuleNotFoundError, ImportError) as e:
from . import basesite
class DaocaorenshuwuSite(basesite.BaseSite):
def _... | StarcoderdataPython |
1638533 | <filename>cnsproject/__init__.py<gh_stars>0
from pathlib import Path
from . import (
utils,
network,
learning,
encoding,
decision,
plotting,
)
ROOT_DIR = Path(__file__).parents[0].parents[0]
| StarcoderdataPython |
3344745 | <reponame>ArianeDucellier/timelags
"""
This module contains different methods of stacking of seismic signal
"""
from obspy.core.stream import Stream
from obspy.signal.filter import envelope
import numpy as np
from scipy.signal import hilbert
def linstack(streams, normalize=True, method='RMS'):
"""
Compute t... | StarcoderdataPython |
1729978 | #!/usr/bin/python
import os, json, errno, codecs
import ConfigParser
import types
import re
_config = ConfigParser.ConfigParser()
_config.read('testconfig.ini')
base_path = _config.get("fix", "root_path")
out_path = _config.get("fix", "out_path")
if out_path == None:
out_path = base_path
def goodPayloadSchema(... | StarcoderdataPython |
3341337 | from datetime import date, timedelta
from django.core.exceptions import ValidationError
from django.test import SimpleTestCase, TestCase
from people import validators
from people.constants import MAX_HUMAN_AGE
from people.factories import PersonFactory
from people.utils import get_todays_adult_dob
class ValidateFul... | StarcoderdataPython |
3396539 | """Main entrypoint into the application.
----
Copyright 2019 Data Driven Empathy 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,
including without limitation the rights ... | StarcoderdataPython |
1717621 | <reponame>opennode/nodeconductor
from __future__ import unicode_literals
import logging
from smtplib import SMTPException
from celery import shared_task
from django.conf import settings
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.utils import timezone
from w... | StarcoderdataPython |
3204080 | # Generated by Django 3.1.8 on 2021-05-13 07:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business_register', '0096_auto_20210511_1204'),
]
operations = [
migrations.AlterField(
model_name='declaration',
na... | StarcoderdataPython |
4835444 | # n 이 1이 될 때까지 , n - 1과 n/k 두 과정 중 하나를 반복적으로 수행한다. n/k 는 n이 k로 나누어 떨어질 때만 선택 / 1이 될때까지 최소횟수를 구하라
n,k = map(int,input().split())
result = 0
while True:
target = ( n // k ) * k
result += (n-target)
n = target
if n<k:
break
result += 1
n //= k
result += (n-1)
print(result)
| StarcoderdataPython |
3226950 | <reponame>petercunning/notebook
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# # netCDF File Visualization Case Study
#
# I was asked by a colleague to visualize data contained within this [netCDF file](https://motherlode.ucar.edu/repository/entry/show/RAMADDA/Unidata/Staff/Julien+Chastang/net... | StarcoderdataPython |
4841173 | <filename>python/cugraph/dask/pagerank/__init__.py
from .pagerank import pagerank, get_chunksize
| StarcoderdataPython |
3236041 | <gh_stars>0
from baseplugin import BasePlugin, PluginPlotItem, SegmentConfig, PluginConfig, PlotConfig
from implotwidget import ImplotWidget
from implotwidget import ImplotWidgetCont
from lineplotwidget import LineplotWidget
from phdplotwidget import PHDPlotWidgetCont
import numpy as np
import time
IM_BITS = 10
PHD_B... | StarcoderdataPython |
80864 | <filename>apptools/logger/agent/quality_agent_mailer.py
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforement... | StarcoderdataPython |
1748771 | <gh_stars>10-100
from server.extensions import db
from sqlalchemy import Numeric
from sqlalchemy.dialects.postgresql import JSONB, UUID
from server.models.mixin import TimestampMixin
from sqlalchemy import (
UniqueConstraint,
)
class Portfolio(db.Model, TimestampMixin):
__tablename__ = "portfolio"
id = d... | StarcoderdataPython |
4811908 | <reponame>c11/earthengine-py-notebooks
import ee
from ee_plugin import Map
# Map an expression over a collection.
#
# Computes the mean NDVI and SAVI by mapping an expression over a collection
# and taking the mean. This intentionally exercises both variants of
# Image.expression.
# Filter the L7 collection to a s... | StarcoderdataPython |
88249 | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | StarcoderdataPython |
1780605 | # Module
import sys
import time
from threading import Thread
from . import updater
from .modules import audio_module, time_module, dropbox_module, wlan_module, internet_module,\
battery_module, load_module
def run():
sys.stdout.write('{"version":1}\n')
sys.stdout.write('[\n')
sys.stdout.write('[]\n')
... | StarcoderdataPython |
67264 | <filename>src/pymor/discretizers/builtin/grids/tria.py
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.core.cache i... | StarcoderdataPython |
3399288 | <reponame>earrighi/Pangolab-1
class Ls350(object):
def __init__(self,inst):
self.inst = inst
def data_info(self,devicenumber):
self.data_keys = [str(devicenumber) + '_LS350_A',str(devicenumber) + '_LS350_B',str(devicenumber) + '_LS350_C',str(devicenumber) + '_LS350_D']
... | StarcoderdataPython |
3315290 | """
File Name: hello_world.py
Tells you what to eat
Usage Examples:
- "What type of food should I eat tonight"
"""
from celestai.classes.module import Module
from celestai.classes.task import ActiveTask
class SpeakPhrase(ActiveTask):
def __init__(self):
# Matches any stat... | StarcoderdataPython |
1608853 | import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name='x', parent_name='streamtube.starts', **kwargs
):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | StarcoderdataPython |
1704585 | <reponame>aswinchari/VAST<filename>scripts/generate_random_clusters.py
import vast.io_mesh as io
import vast.surface_tools as st
import numpy as np
import nibabel as nb
import csv
import argparse
import os
flatten = lambda l: [item for sublist in l for item in sublist]
#load in data
def main(args)
neighbours=st... | StarcoderdataPython |
1759465 | import errno
import socket
import time
from microio import *
__all__ = ('Stream', 'connect', 'listen', 'serve', 'spawn')
class Stream:
def __init__(self, sock, read_size=65536):
sock.setblocking(False)
self.sock = sock
self.buffer = b''
self.read_size = read_size
def close... | StarcoderdataPython |
97512 | <reponame>SNU-Blockchain-2021-Fall-Group-H/aries-cloudagent-python
"""Test resolver routes."""
# pylint: disable=redefined-outer-name
import pytest
from asynctest import mock as async_mock
from pydid import DIDDocument
from ...admin.request_context import AdminRequestContext
from .. import routes as test_module
from... | StarcoderdataPython |
61639 | #!/usr/bin/env python
# coding=utf-8
'''
@Description:
@Author: Xuannan
@Date: 2019-12-15 22:25:14
@LastEditTime: 2020-03-03 16:16:55
@LastEditors: Xuannan
'''
from flask_restful import Resource,reqparse,fields,marshal,abort,inputs
from app.models import Admin,AdminLog,AdminRole, Crud
from app.apis.api_constant impo... | StarcoderdataPython |
133482 | # =============================================================================
# PROJECT CHRONO - http://projectchrono.org
#
# Copyright (c) 2014 projectchrono.org
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file at the top level of the distr... | StarcoderdataPython |
4830080 | '''
practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses
by <NAME>/<NAME>
'''
#testing variables
x = 25
print (x)
x = 30
print (x)
#end of the Program | StarcoderdataPython |
3286757 | <gh_stars>1-10
import aiocqhttp
import nonebot
import config
bot = nonebot.get_bot()
group_stat = {}
@nonebot.on_websocket_connect
async def _(event: aiocqhttp.Event):
await bot.send_private_msg(user_id = config.SUPERUSERS, message = '软白上线惹≥w≤')
@bot.on_message()
async def grouprepeat(event):
if event['messa... | StarcoderdataPython |
1793959 | from django.contrib import admin
from .models import Newsletter
# Register your models here.
class NewsletterAdmin(admin.ModelAdmin):
list_display = ('first_name', 'email',)
admin.site.register(Newsletter, NewsletterAdmin) | StarcoderdataPython |
3218115 | <reponame>ligmitz/zulip<gh_stars>1-10
import json
import re
from typing import Callable, Iterator, List, Optional, Union
import scrapy
from scrapy.http import Request, Response
from scrapy.linkextractors import IGNORED_EXTENSIONS
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
from scrapy.spidermiddleware... | StarcoderdataPython |
1673652 | <reponame>DhellionFena/flask-CatsAPI<gh_stars>0
from sql_alchemy import db
class UserModel(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
nome = db.Column(db.String(40), nullable=False)
sobrenome = db.Column(db.String(120), nullable=False)
email = db.Column(db.String(80), nullable... | StarcoderdataPython |
38076 | import json
import os
import pymongo
'''
fileService.py
Author: <NAME>
'''
mongo_client = pymongo.MongoClient()
#db = {}
'''
initialize
Takes a 'unique_id'entifier and sets up a database in MongoDB
and ensures that that database has collections associated with
the various file types that are stored.
'''
def init... | StarcoderdataPython |
168647 | import pygame
import time
import datetime
import os
import Colors
import SwitchState
import random
from photoslideshow import Photoslideshow
class Photobox():
def __init__(self, windowsize, photofolder, camera, switch, cheesepicfolder):
pygame.init()
self.windowsize = windowsize
self.phot... | StarcoderdataPython |
83785 | import unittest
import dwmon
class CronTests(unittest.TestCase):
def test_parse_requirements(self):
cron_string = "CHECKHOURS0-9 CHECKMINUTES0-10 " \
"WEEKDAYS MINNUM5 MAXNUM20 LOOKBACKSECONDS3600"
result = dwmon.parse_requirements(cron_string)
self.assertTrue(result["check_ho... | StarcoderdataPython |
3312730 | # -*- coding: utf-8 -*-
'''
Microbial Bioinformatics Group in MML,SJTU
run_pssm.py: Script for generating PSSM profiles
<NAME> <<EMAIL>>
Usage:
$ python run_pssm.py -i <input sequence>
-db <blast database>
-e <evalue>
-n <num_iteration>
... | StarcoderdataPython |
142864 | <gh_stars>0
import numpy
import matplotlib.pyplot as plt
import os
gw_in = numpy.array([[20, 1.4114],
[30, 1.2706],
[40, 1.2018],
[50, 1.1599],
[60, 1.1326]])
gw_out = numpy.array([[20, 1.2103],
[30, 1.1385],
... | StarcoderdataPython |
148702 | <filename>08 Hash/hashTablePrac.py
class HashTable(object):
def __init__(self,size):
self.size = size
self.slots = [None] * self.size
self.data = [None] * self.size
def put(self,key,data):
hashValue = self.hashFunc(key,len(self.slots))
... | StarcoderdataPython |
187178 | from flask.json import jsonify
from model.Media import Media
from model.Poster import Poster
from model.Reply import Reply
from model.Thread import Thread
from shared import db
class ThreadPosts:
def get(self, thread_id):
session = db.session
thread = session.query(Thread).filter(Thread.id == thre... | StarcoderdataPython |
1609210 | <gh_stars>0
# Author: <NAME>
# Date: 2015
"""
Visualize the generated localization synthetic
data stored in h5 data-bases
"""
from __future__ import division
import os
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
import h5py
from common import *
def viz_textbb(text_im, charBB_list, wor... | StarcoderdataPython |
4814647 | #!/usr/bin/env python
"""
@file route_departOffset.py
@author <NAME>
@author <NAME>
@date 11.09.2009
@version $Id$
Applies a given offset to the given route's departure time
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors
This file... | StarcoderdataPython |
3208860 | <filename>train.py
import time
import os
import copy
import pdb
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import model
from data import guipang
from data import qiafan
from tensorboardX import SummaryWriter
from torch.utils.data imp... | StarcoderdataPython |
1728437 | import datetime
import time
from json_model import fields
from json_model import libs
class Scholarship(libs.JsonModel):
amount = fields.Float(required=True)
currency = fields.String(default='USD')
months = fields.List(required=True)
class Student(libs.JsonModel):
name = fields.String(required=True... | StarcoderdataPython |
77721 | <gh_stars>0
f_chr6 = open("/hwfssz1/ST_BIOCHEM/P18Z10200N0032/liyiyan/SV_Caller/HG002/chr6_reads.fastq")
liness = f_chr6.readlines()
reads_list = []
for i in range(1,len(liness),4):
reads_list.append(liness[i])
res = min(reads_list, key=len,default='')
print(len(res)-1)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.