id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5036814 | #!/usr/bin/env python3
import json
import logging
import sys
from flask import Blueprint
import flask
from yabgp.agent import prepare_service
from yabgp.common import constants
from yabgp.handler import BaseHandler
from yabgp.api import app
from yabgp.api import utils as api_utils
from yabgp.api.v1 import auth
LOG... | StarcoderdataPython |
5129010 | #we import the sleep module from the time library
from time import sleep
#we import the RPi.GPIO library with the name of GPIO
import RPi.GPIO as GPIO
#we set the pin numbering to the GPIO.BOARD numbering
#for more details check the guide attached to this code
GPIO.setmode(GPIO.BOARD)
#we set the PIN8 as an output pi... | StarcoderdataPython |
12846377 | from .context import GlobalContext
from .dao import BaseDao
from .model import BaseModel
from .service import BaseService
from .schema import BaseSchema, DeleteSchema, DeleteResponseSchema, ListSchema
from .crud import BaseCrud
from .message_generator import get_message
| StarcoderdataPython |
3557410 | from collections import deque
a = deque(maxlen = 3)
a.append(3)
a.append(2)
a.append(1)
a.append(0)
print(a) | StarcoderdataPython |
280221 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
class DepthInfo:
# The default depth that we travel before forcing a foreign key attribute
DEFAULT_MAX_DEPTH = 2
# The max depth set if the user specif... | StarcoderdataPython |
3352913 | <filename>AHKsaveWiki.py
#!/usr/bin/env python3
""" This script does a local copy of my distant wiki.
It synchronises the web root folder and the mysql database.
Important notes:
- The source server is the local computer.
- The target computer is the distant server on which the wiki is.
"""
import sys
import o... | StarcoderdataPython |
189913 | <filename>app/server/test/testBaseDataObject.py
import time
import sys
sys.path.append('..')
import config.config as config
from data_object.base_data_object import BaseDataObject
from data_store.database_driver.mysql_driver import MySqlDriver
from data_store.cache_driver.redis_driver import RedisDriver
from data_sto... | StarcoderdataPython |
8117281 | # -*- coding: utf-8 -*-
"""
"""
import os
from datetime import datetime
from typing import Union, Optional, Any, List, NoReturn
from numbers import Real
import wfdb
import numpy as np
np.set_printoptions(precision=5, suppress=True)
import pandas as pd
from ..utils.common import (
ArrayLike,
get_record_list_re... | StarcoderdataPython |
1607283 | <gh_stars>0
from objects.base import Base
class Connector(Base):
def __init__(self, from_field: str, from_instance: str, from_instance_type: str, to_field: str, to_instance: str,
to_instance_type: str, mapping_name: str):
self.from_field = from_field
self.from_instance = from_inst... | StarcoderdataPython |
9602315 | # Wrapper for pomegranate.GeneralMixtureModel of pomegranate.distributions.UniformDistribution objects
import bisect
import numpy as np
from pomegranate import GeneralMixtureModel as GMM
from pomegranate.distributions import UniformDistribution as UD
import chippr
from chippr import defaults as d
from chippr import... | StarcoderdataPython |
372262 | # Copyright 2015-2016 HyperBit developers
# pylint: disable=too-many-arguments,too-many-instance-attributes
import enum
from hyperbit import crypto, serialize
class Type(enum.IntEnum):
getpubkey = 0
pubkey = 1
msg = 2
broadcast = 3
class Getpubkey23():
def __init__(self, ripe):
self.ri... | StarcoderdataPython |
9770602 | from turtle import Screen
class GUI:
def __init__(self):
self.screen = Screen()
self.screen.setup(800, 600)
self.screen.bgcolor("black")
self.screen.title("Pong")
self.screen.tracer(0)
# PUBLIC METHODS
def update(self):
self.screen.update()
def exiton... | StarcoderdataPython |
11244258 | """
=======================================
Compare RNA and DNA sequencing results
=======================================
:Author: <NAME>
:Release: $Id$
:Date: |today|
:Tags: Python
"""
# load modules
from ruffus import *
import CGAT.Experiment as E
import logging as L
import CGAT.Database as Database
import CGAT.... | StarcoderdataPython |
1925356 | # -*- coding: utf-8 -*-
import os
from os.path import join as opj
import numpy as np
import matplotlib.pyplot as plt
from perclearn import mnist_reader
from perclearn.utils import (create_2D_noise,
scale_2D,
create_new_dataset,
)
... | StarcoderdataPython |
255324 | # Copyright 2021 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
11353922 | #!/usr/bin/env/py35
# coding=utf-8
from flask import Flask
app = Flask(__name__)
@app.route('/')
def test():
return "hello flask"
if __name__ == '__main__':
app.run('0.0.0.0',8080) | StarcoderdataPython |
1969604 | # *****************************************************************************
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from ipywidgets import Widget
... | StarcoderdataPython |
167104 | <reponame>beveradb/ecs-digital-interview-test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
class TestHelpers(object):
"""Tests for Helpers class in `migration_runner` package."""
def test_extract_sequence_sql_filename_expected(
self, helpers, sql_filename_expected
):
v... | StarcoderdataPython |
1923040 | """
Code adapted from JMEE
"""
import os
cwd = os.getcwd()
import sys
from pathlib import Path
sys.path.append(os.path.join(Path(os.getcwd()).parent, "OnlineAlignment"))
import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import numpy as np
from CRF import *
from pytorch_pretra... | StarcoderdataPython |
1785315 | <reponame>PaddlePaddle/PaddleCLS<filename>deploy/paddleserving/test_cpp_serving_client.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | StarcoderdataPython |
191203 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-10-01 11:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum_conversation', '0011_topic_dummy'),
]
operations = [
migrations.AddFi... | StarcoderdataPython |
9614820 | <reponame>iandennismiller/cata<gh_stars>0
# -*- coding: utf-8 -*-
# catalog (c) <NAME>
import os
import csv
import json
from shutil import copyfile
import hashlib
import pandas
from pandas.util import hash_pandas_object
class Cata:
def __init__(self, root_path=".cata"):
self.root_path = root_path
... | StarcoderdataPython |
1803075 | from .cli import relay_setup_and_start
if __name__ == "__main__":
relay_setup_and_start()
| StarcoderdataPython |
11220240 | <reponame>salazarpardo/redinnovacion
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'^new/$',
views.CreateEmailMessageCreateView.as_view(),
name='email_message_list'
),
url(
r'^$',
views.EmailMessageListView.as_view(),
name='emai... | StarcoderdataPython |
1851576 | <reponame>iMoonLab/THU-HyperG<filename>hyperg/learning/classification/inductive.py
# coding=utf-8
import numpy as np
import scipy.sparse as sparse
from hyperg.hyperg import HyperG, IMHL
from hyperg.utils import print_log, init_label_matrix, calculate_accuracy
def inductive_fit(hg, y, lbd, mu, eta, max_iter, log=True... | StarcoderdataPython |
5072022 | <reponame>vijay-jaisankar/hue
import numpy as np
import pandas as pd
# Conversion Constants
_NUMERALS = '0123456789abcdefABCDEF'
_HEXDEC = {v: int(v, 16) for v in (x+y for x in _NUMERALS for y in _NUMERALS)}
LOWERCASE, UPPERCASE = 'x', 'X'
# To read the image
from imageio import imread
# Preprocessing the image
... | StarcoderdataPython |
3380943 | <reponame>yabirgb/caucab<gh_stars>1-10
"""src URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$',... | StarcoderdataPython |
11312933 | <reponame>heliumplusdatastage/tycho
import pytest
from tycho.model import Volumes
# Sample data from conftest.py
@pytest.mark.parametrize('volume_model_data', ['data1'], indirect=True)
def test_model_volume(volume_model_data):
id_num = "333333333"
volumes = Volumes(id_num, volume_model_data)
data_volumes... | StarcoderdataPython |
6576709 | """Tests for `greenguard.benchmark` module."""
from sklearn.metrics import f1_score
from greenguard.benchmark import evaluate_templates
from greenguard.demo import load_demo
def test_predict():
# setup
templates = [
'unstack_lstm_timeseries_classifier'
]
window_size_rule = [
('1d', '... | StarcoderdataPython |
5054039 | <gh_stars>0
import fiftyone as fo
import fiftyone.zoo as foz
dataset = foz.load_zoo_dataset("quickstart")
# Create a custom App config
app_config = fo.AppConfig()
app_config.show_confidence = True
app_config.show_attributes = True
session = fo.launch_app(dataset, config=app_config, port=5151)
session.wait() | StarcoderdataPython |
1753106 | <gh_stars>0
import tensorflow as tf
import numpy as np
import pickle
import json
import cv2
import sys
import os
import time
sys.path.append(os.path.abspath(os.path.join('..', '3rd_party')))
from ServiceMTCNN import detect_face as lib
def extract_faces_from_image(input_img, pnet, rnet, onet):
# sess = tf.Session... | StarcoderdataPython |
6561119 | import pytest
from Foo.bar import posts
@pytest.mark.asyncio
async def test_get_post_exists():
returned_post = await posts.get_post('0')
assert returned_post.id == 0
assert returned_post.text == 'Text for the post body.'
# assert True == False
| StarcoderdataPython |
4903690 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2020, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | StarcoderdataPython |
6407926 | <reponame>petersn/ChompZero
#!/usr/bin/python
## Workaround?
#import gevent.hub
#gevent.hub.Hub.backend = "poll"
import numpy
import Queue, threading, time, random, sys, hashlib
import gevent.event, gevent.queue, gevent.server
from mprpc import RPCServer
import engine
import train
import model
submit_queue = gevent.... | StarcoderdataPython |
195874 | from setuptools import setup, find_packages
setup(
name='sensorpad',
description='No-dependencies Python client for Sensorpad.',
version='0.0.6',
license='MIT',
author="<NAME>",
author_email='<EMAIL>',
packages=find_packages(),
url='https://github.com/sensorpad/sensorpad-python',
ke... | StarcoderdataPython |
3542090 | <gh_stars>0
import datetime
import io
import json
import re
import tarfile
from connexion import request
import typing
import anchore_engine.apis
import anchore_engine.common
import anchore_engine.common.images
import anchore_engine.configuration.localconfig
import anchore_engine.subsys.metrics
from anchore_engine im... | StarcoderdataPython |
31818 | <filename>import_result.py
#!/usr/bin/env python
""" Script to convert a result into the standard format of this directory """
import argparse
import bilby
import numpy as np
# Set a random seed so the resampling is reproducible
np.random.seed(1234)
parser = argparse.ArgumentParser()
parser.add_argument('result', h... | StarcoderdataPython |
1610613 | from authlib.common.urls import add_params_to_uri
from authlib.oauth2.rfc6749.grants import \
ResourceOwnerPasswordCredentialsGrant as _PasswordGrant
from .models import Client, User, db
from .oauth2_server import TestCase, create_authorization_server
class PasswordGrant(_PasswordGrant):
def authenticate_use... | StarcoderdataPython |
1968288 | ###
## This is a brief library for working with a vibration motor array
## transforming distances into the various PWM motor outputs
###
# for exponential transform
from math import pow
# main function to handle the different types of feedback
def getFeedbackVal(distance, leftMin, leftMax, rightMin, rightMax, ... | StarcoderdataPython |
123763 | import os
# hydra
import hydra
from omegaconf import DictConfig, OmegaConf
# pytorch-lightning related imports
from pytorch_lightning import Trainer
import pytorch_lightning.loggers as pl_loggers
from pytorch_lightning.callbacks import LearningRateMonitor
# own modules
from dataloader import PL_DataModule
from metho... | StarcoderdataPython |
9747238 | #!/usr/bin/env python
"""The JIP parser module provides methods to parse tools from scripts.
"""
import os
import re
from collections import defaultdict
from textwrap import dedent
from jip.tools import Block, ScriptTool
#currently supported block type
VALIDATE_BLOCK = "validate"
COMMAND_BLOCK = "command"
SETUP_BLOCK... | StarcoderdataPython |
8005554 | from time import monotonic
from typing import final
from discord.ext import commands
import discord
from pymongo import mongo_client
from cogs.utils import context
from cogs.utils.config import Config
from cogs.utils.db import RoDBClient
import datetime
import json
import os
import click
import logging
import asyncio
i... | StarcoderdataPython |
6453098 | from __future__ import division
import json
UNITED_STATES = 231
#i=>importer, e=>exporter, c=>productcode, a=>amount in tonnes
matrix = json.loads(open('clean/trade-matrix-2011.json','rb').read())
items = json.loads(open('clean/items-by-code.json','rb').read())
countries = json.loads(open('clean/countries-by-code.... | StarcoderdataPython |
1754048 | <filename>linear_algebra.py
from typing import List
Vector = List[float]
height_weight_age = [70, # inches,
170, # pounds,
40 ] # years
grades = [95, # exam1
80, # exam2
75, # exam3
62 ] # exam4
def add(v: Vector, w: Vector... | StarcoderdataPython |
3592348 | import json
import os
import pathlib
import re
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import config
from util import path
RECORD_DIR = os.path.join(os.path.abspath("."), "record", "ensemble")
pathlib.Path(RECORD_DIR).mkdir(parents=True, exist_ok=Tru... | StarcoderdataPython |
5022190 | '''
REDS dataset
support reading images from lmdb, image folder and memcached
'''
import os.path as osp
import os, random
import pickle
import logging
import numpy as np
import cv2
from PIL import Image
import lmdb
import torch
import torch.utils.data as data
import torch.nn.functional as F
import data.util as util
try... | StarcoderdataPython |
4804439 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
a demo on class usage and other things...
"""
from models.family.large.large import large_family
def main():
myfamily = large_family() # calling our derived class
myfamily.set_min_members() # returning from parent class
myfamily.set_min_age(2) # sett... | StarcoderdataPython |
3445604 | <reponame>CMeza99/lcs
# pylint: disable=no-self-use, too-few-public-methods
"""Tests for `lcs` package."""
# TODO: Make proper tests, i.e. fixtures
import logging
from lcs.main import _pmatches, matches
class TestLcs:
"""Tests for `lcs.main` module."""
def test_pmatch_000(self):
"""First Test run.""... | StarcoderdataPython |
9797793 | __author__ = "<NAME>"
__copyright__ = "Copyright 2017, The Databox Project"
__credits__ = ["Databox team"]
__license__ = "GPL"
__version__ = "0.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import urllib3
import os
import json
import base64
from urllib.parse import urlencode
import ti... | StarcoderdataPython |
110672 | from django.db import models
from .base_workflow import Ticket, TicketHistory
class ServiceRequest(Ticket):
AC_STATUS = (
('aog', 'AOG'),
('mtx', 'Scheduled Maintenance'),
('other', 'Other (Provide in Description)')
)
CERTS = (
('far91', 'FAR 91'),
('far121', 'F... | StarcoderdataPython |
8095259 | """Route that provides recommended strains based on input.
POST '/recommends'
"""
import logging
from typing import List, Optional
from fastapi import APIRouter
from pydantic import BaseModel, Field
from ..recommend import get_recommendations
log = logging.getLogger(__name__)
router = APIRouter()
class RecommendR... | StarcoderdataPython |
4864854 | import os
from helper_evaluate import compute_accuracy, compute_mae_and_mse
from helper_losses import niu_loss, coral_loss, conditional_loss, conditional_loss_ablation
from helper_data import levels_from_labelbatch
import time
import torch
import torch.nn.functional as F
from collections import OrderedDict
import jso... | StarcoderdataPython |
4964585 | #!/usr/bin/env python3
# encoding: utf-8
# Copyright 2019 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from pynn.io.kaldi_seq import ScpStreamReader, ScpBatchReader
from pynn.net.seq2seq import Seq2Se... | StarcoderdataPython |
4830156 | # -*- coding: utf-8 -*-
"""
根据标注数据(.npy)生成训练和验证数据集,采用generator的形式生成数据。中间包含了
数据增强以及打乱样本顺序的操作。
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import numpy as np
from imgaug import ALL_AUG_METHODS
class Batch(object):
def __init__(s... | StarcoderdataPython |
4957511 | #!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. <NAME> (<EMAIL>) and the
# RMG Team (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person obtai... | StarcoderdataPython |
3243538 | <filename>backend-api/database.py
from sqlalchemy import Column, ForeignKey, Integer, String, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
name = Col... | StarcoderdataPython |
6599629 | <reponame>jpic/django-nested-admin
import time
from nested_admin.tests.base import BaseNestedAdminTestCase
from .models import GFKRoot, GFKA, GFKB
class TestGenericInlineAdmin(BaseNestedAdminTestCase):
root_model = GFKRoot
def test_add_to_empty_one_deep(self):
root = self.root_model.objects.create(... | StarcoderdataPython |
9729194 | # -*- coding: utf-8 -*-
import pytest
import botocore
import boto3
from flexmock import flexmock
from pontus import AmazonS3FileValidator
from pontus.exceptions import FileNotFoundError, ValidationError
from pontus.validators import BaseValidator
HOUR_IN_SECONDS = 60 * 60
class AnyDict:
def __eq__(self, other):... | StarcoderdataPython |
3379283 | # P-score interpretation (for positive ou negative P-score)
# 0.9 or above means a very strong correlation.
# 0.7 up to 0.9 means a strong correlation.
# 0.5 up to 0.7 means a moderate correlation.
# 0.3 up to 0.5 means a weak correlation.
# 0 up to 0.3 is a meaningless correlation.
from math import sqrt, pow
def pear... | StarcoderdataPython |
6579094 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, Arm Limited and contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | StarcoderdataPython |
55888 | <reponame>uinvent/flask_boilerplate
"""
Address Model
"""
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship
from .base import BaseModel
class AddressModel(BaseModel):
__tablename__ = 'address'
id = Column(Integer, primary_key=True, nullable=False)
line_1 = ... | StarcoderdataPython |
1745527 | <reponame>LadaOndris/IBT
import matplotlib.pyplot as plt
import numpy as np
import src.estimation.configuration as configs
from src.datasets.bighand.dataset import BighandDataset
from src.datasets.msra.dataset import MSRADataset
from src.estimation.preprocessing import DatasetPreprocessor
from src.estimation.architect... | StarcoderdataPython |
8163313 | """
Customer resource, it includes the class Resource and two request
classes to create and update the resource.
"""
import datetime as dt
from typing import ClassVar, Optional, cast
from pydantic import BaseModel
from pydantic.dataclasses import dataclass
from ..types.general import CustomerAddress
from .base impo... | StarcoderdataPython |
328881 | <filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/learning_sequences/api/processors/base.py<gh_stars>1-10
"""
This module defines the base OutlineProcessor class that is the primary method
of adding new logic that manipulates the Course Outline for a gi... | StarcoderdataPython |
197682 | <reponame>JWang169/LintCodeJava
class Solution:
def expand(self, S: str) -> List[str]:
return sorted(self.dfs(S, ['']))
def dfs(self, s, prev):
if not s:
return prev
n = len(s)
cur = ''
found = False
result = []
for i in ... | StarcoderdataPython |
4847422 | <filename>tfoptflow/losses.py
"""
losses.py
Loss functions.
Written by <NAME>
Licensed under the MIT License (see LICENSE for details)
Based on:
- https://github.com/NVlabs/PWC-Net/blob/master/Caffe/model/train.prototxt
Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY... | StarcoderdataPython |
9677225 | import asyncio
from common import globall as G
from god.conf import tune as T
from common.crypto import Hash, Ecc
from god import handle
def check_rx(c_list):
'''
different c_types have different checks:
check the valid of hash and sign of the card
'''
T.LOGGER.debug('')
if c_list[G.P_V... | StarcoderdataPython |
375868 | <reponame>lucasjurado/Curso-em-Video<gh_stars>1-10
vlr_casa = float(input('Qual o valor da casa? R$ '))
salario = float(input('Qual é o seu salário? R$ '))
anos = float(input('Em quantos anos você deseja financiar a casa? '))
parcela = vlr_casa/(anos*12)
print(f'Para pagar uma casa de R$ {vlr_casa:.2f} em {anos:.0f} a... | StarcoderdataPython |
240181 | <filename>tests/shared/test_validation.py
import pytest
from unittest.mock import patch
from vulnerable_people_form.form_pages.shared import validation
from flask import Flask
from vulnerable_people_form.form_pages.shared.answers_enums import (
ApplyingOnOwnBehalfAnswers,
MedicalConditionsAnswers,
NHSLette... | StarcoderdataPython |
112575 | import vrealizeautomation.vra as vrealize_automation
import appvars
# Create an instance of the vraauthentication class.
my_vra = vrealize_automation.vraauthentication(appvars.vra_prod_fqdn,
appvars.vra_prod_tenant_name,
app... | StarcoderdataPython |
8157790 | <gh_stars>1-10
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import Joy
from motion_control.msg import MotionCommand, Segment, JointState, SegmentResponse
from trajectory import freq_map
from time import sleep
from math import copysign
from math import ceil
N_AXES =6
def timed_callback(event, memo):
if... | StarcoderdataPython |
1668462 | import json
import hail as hl
class JSONEncoder(json.JSONEncoder):
"""JSONEncoder that supports some Hail types."""
def default(self, o):
if isinstance(o, (hl.utils.frozendict, hl.utils.Struct)):
return dict(o)
if isinstance(o, hl.utils.Interval):
return {
... | StarcoderdataPython |
8149676 | # -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 |
3490924 | <filename>experiments/ca/featurizer.py
from collections import defaultdict
from enum import Enum, auto, unique
from typing import Any, List, Optional
import numpy as np
import slurmee as slurmee
from diskcache import Cache
from sentence_transformers import SentenceTransformer
from sklearn.feature_extraction.text impor... | StarcoderdataPython |
4872980 | <reponame>wuttinanhi/dumb-lang<filename>src/test.py
from tokenizer import ETokenType, Tokenizer
def test():
test1 = Tokenizer('PRINT "Hello, World!"')
test1_tokens = test1.tokenize()
assert test1_tokens[0].type == ETokenType.KEYWORDS
assert test1_tokens[1].type == ETokenType.INDENT
assert test1_to... | StarcoderdataPython |
3544272 | <gh_stars>0
# Copyright (c) 2011 The Chromium OS Authors.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# 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 vers... | StarcoderdataPython |
11244294 | # Copyright (c) 2014-2018 Barnstormer Softworks, Ltd.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import os.path
#from cr... | StarcoderdataPython |
132209 | <gh_stars>1-10
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------------------... | StarcoderdataPython |
1886078 | <filename>visualdet3d/optim/schedulers.py
from typing import Union
from easydict import EasyDict as edict
import numpy as np
from tensorflow.keras.optimizers.schedules import LearningRateSchedule
from tensorflow.keras.optimizers.schedules import (
ExponentialDecay, CosineDecay
)
class PolyLR(LearningRateSchedule... | StarcoderdataPython |
215913 | <filename>bitbake/lib/toaster/contrib/tts/shellutils.py
#!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2015 <NAME> for Intel Corp.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gener... | StarcoderdataPython |
8068653 | # plugin inspired by "system_upgrade.py" from rpm-software-management
from __future__ import print_function
import json
import dnf
import dnf.cli
CMDS = ['download', 'upgrade', 'check']
class DoNotDownload(Exception):
pass
def _do_not_download_packages(packages, progress=None, total=None):
raise DoNotDow... | StarcoderdataPython |
29003 | <reponame>pearlfranz20/AL_Core
from apprentice.agents import SoarTechAgent
from apprentice.working_memory import ExpertaWorkingMemory
from apprentice.working_memory.representation import Sai
# from apprentice.learners.when_learners import q_learner
from ttt_simple import ttt_engine, ttt_oracle
def get_user_demo():
... | StarcoderdataPython |
1685692 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# <NAME>, <EMAIL>
#
# All rights are reserved
#
# generic_update.py
# update db with a generic method
#
def generic_update(_redis, _cls, _uuid, _data):
_key = _cls.__tablename__ + ".uuid." + _uuid
if not _redis.exists(_key):
return False
... | StarcoderdataPython |
5176430 | from wikipedia import Wikipedia
from wolfram import Wolfram
from query import QnA
| StarcoderdataPython |
116806 | <filename>core/place.py
# -*- coding: utf-8 -*-
"""A physical place.
Example:
Attributes:
Todo:
* Nothing for now.
.. _Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
from geometry.angle import AngleInRadians
class Place(object):
def __init__(self, latitude: AngleInRadi... | StarcoderdataPython |
11201924 | <reponame>preym17/csit<gh_stars>0
# Copyright (c) 2018 Cisco and/or its affiliates.
# 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
#
# Unles... | StarcoderdataPython |
4902851 | """Utilities for running HammerBlade in F1.
"""
import boto3
import enum
import shlex
import click
import subprocess
import socket
import time
import os
import logging
import click_log
from collections import namedtuple
import tomlkit
__version__ = '1.0.0'
SSH_PORT = 22
# The setup script to run on new images.
SETU... | StarcoderdataPython |
5046913 | # Pseudocode
"""
procedure DFT(G, v) is
label v as discovered
for all directed edges from v to w that are in G.adjacentEdges(v) do
if vertex w is not labeled as discovered then
recursively call DFT(G, w)
"""
adjList = {
1: {2, 3},
2: {4},
3: {4},
4: {1}
}
visited = set()
de... | StarcoderdataPython |
1601372 | <filename>models/graph/gat/gat_model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.graph.gat.layers import GraphAttentionLayer, SpGraphAttentionLayer
class GAT(nn.Module):
"""Dense version of GAT."""
def __init__(self, nin, nhid, nout, alpha, nheads):
super(GAT, sel... | StarcoderdataPython |
1655400 | # coding: utf-8
"""
OpenLattice API
OpenLattice API # noqa: E501
The version of the OpenAPI document: 0.0.1
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from openlattice.configuration import Configuration
class EntityLin... | StarcoderdataPython |
11229687 | <filename>fit_screen_logit.py
import sklearn
import pandas as pd
from sklearn.model_selection import train_test_split
import numpy as np
# 导入线性模型和多项式特征构造模块
from sklearn.preprocessing import PolynomialFeatures
from sklearn import linear_model
from sklearn import externals
from sklearn.metrics import precision_recall_cur... | StarcoderdataPython |
1747695 | from torch.utils.data import Dataset, IterableDataset, DataLoader
from itertools import cycle, islice
from . import AuthInfo, Range, Configuration, ZookeeperInstance, AccumuloConnector, Authorizations, Key, AccumuloBase
class AccumuloCluster(AccumuloBase, IterableDataset):
def __init__(self, instance: str , zooke... | StarcoderdataPython |
3598534 | import os
from environment import Environment
from utils import display_status_banner
class BackendServicesDataImporter:
def __init__(self, env: Environment):
self.env = env
self.test_data_dump_filepath = self._get_test_data_dump_filepath()
def populate_postgres_with_test_data(self) -> None... | StarcoderdataPython |
354481 | from __future__ import print_function
import glob
import json
import os
import random
import sys
import time
from microservice.common import service_discovery
from microservice.local_magellan import haproxy
MICROSERVICE_ENV = os.environ.get('MICROSERVICE_ENV') or None
MICROSERVICE_APP_ID = os.environ.get('MICROSERVI... | StarcoderdataPython |
37079 | <reponame>birm/StatMail
from .SMBase import SMBase
""" A collection of builtin server types. """
class Types(SMBase):
"""A class for keeping track of all types supported."""
# TODO read from files later for types, but for now...
supported = ["minimal"]
@classmethod
def supported(self, stype):
... | StarcoderdataPython |
6576273 | <reponame>sgrepo/celery-unique
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import inspect
import unittest
try:
from unittest import mock
except ImportError:
import mock
from celery import uuid
from celery.result import A... | StarcoderdataPython |
92086 | from django.urls import path, include
from . import views
# from utils import router
urlpatterns = [
path('', views.home),
# Search for channels
path('channels',views.channels),
# enter/alter/delete a certain channel
path('channels/<int:id>',views.channels_id),
path('channels/<int:id>/users'... | StarcoderdataPython |
3475133 | <gh_stars>0
import komand
from .schema import SubmitUrlInput, SubmitUrlOutput, Input, Output, Component
# Custom imports below
from copy import copy
from json.decoder import JSONDecodeError
from komand.exceptions import PluginException
class SubmitUrl(komand.Action):
def __init__(self):
super(self.__clas... | StarcoderdataPython |
8054041 | <filename>attachdb/connection.py<gh_stars>0
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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/... | StarcoderdataPython |
9684317 | import os
from win32api import GetFileVersionInfo, LOWORD, HIWORD #Referred to VB API from MSDN to retrieve version attributes for dll and exe files
#import csv
from openpyxl import Workbook
sourceDir = r'c:\NewRelease'
#targetDir = r'c:\release'
targetDir = r'c:\LiberateDev\AutoUpdates'
targetDir2 = r'c:\LiberateDe... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.