id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
327975 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*
''' I3Modules to add Labels for deep Learning
'''
from __future__ import print_function, division
import numpy as np
from icecube import dataclasses, icetray
from icecube.icetray.i3logging import log_error, log_warn
from ic3_labels.labels.base_module import M... | StarcoderdataPython |
1922087 | """ The MIT License (MIT)
Copyright (c) 2016 <NAME>, University of Massachusetts
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 ... | StarcoderdataPython |
3321690 | <reponame>AustinSmith29/basketball_reference_web_scraper<gh_stars>1-10
from unittest import TestCase, mock
from basketball_reference_web_scraper.data import OutputWriteOption
from basketball_reference_web_scraper.writers import CSVWriter, WriteOptions
class TestCSVWriter(TestCase):
DATA = ["some", "row", "data"]... | StarcoderdataPython |
6444046 | <filename>tests/__init__.py
""" unit test """
import difflib
import inspect
import json
import logging
import os
import sys
import tempfile
from io import StringIO
from logging import Handler
from random import random
from unittest.case import TestCase
from bzt.cli import CLI
from bzt.engine import SelfDiagnosable
fro... | StarcoderdataPython |
1754237 | <filename>tests/kyu_8_tests/test_smallest_unused_id.py
import unittest
from katas.kyu_8.smallest_unused_id import next_id
class NextIDTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(next_id([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 11)
def test_equals_2(self):
self.assertEqua... | StarcoderdataPython |
3280441 | <filename>django_admin_json_editor/admin.py
import json
from django import forms
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class JSONEditorWidget(forms.Widget):
template_name = 'django_admin_json_editor/editor.html'
def __init__(self, schema, collapsed... | StarcoderdataPython |
3398627 |
import os
#path = "/usr/src/app/data"
#path = "./data"
#os.chdir(path)
path = os.path.dirname(os.path.realpath('__file__'))
dirPath = path + "/data/"
def handleFile(filePath):
print(__file__)
with open(filePath, 'r') as f:
print(f.read())
# For all files
for file in os.listdir(dirPath):
if... | StarcoderdataPython |
3222448 | """Data object helpers."""
#
# Copyright 2019 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 ... | StarcoderdataPython |
8136223 | <filename>tests/poc/test_pipeline.py<gh_stars>1-10
import os
import unittest
import pandas as pd
from evaluator.models.document import Document
from evaluator.models.standard_item import StandardItem
from evaluator.models.standard_item_keyword import StandardItemKeyword
from evaluator.models.disclosure_score import Dis... | StarcoderdataPython |
1915704 | <gh_stars>0
import json
f = open("../../config/executer.txt")
processors = []
action_map = {}
actions = []
primitive_list = []
primitive_num = 0
primitive_idx = 0
cur_idx = 0
while True:
line = f.readline()
print(line)
if not line:
break
if line == "\n":
continue
l = line.spli... | StarcoderdataPython |
3459668 | import numpy as np
import random, json
import nltk_utils
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from nltk_utils import bag_words, tokeniser, stem
import model
from model import Network
with open('intents.json','r') as f:
intents=json.load(f)
Words=[]
tags=[]
xy=[]
... | StarcoderdataPython |
1921325 | from collections import namedtuple
class GoldenFile:
"""Record the correct running results in a file for comparing with following test results."""
def __init__(self, filename):
self.filename = filename
def make(self, text):
with open(self.filename, 'w+') as f:
f.write(text)
... | StarcoderdataPython |
1628400 | <gh_stars>0
"""
10 - Faca uma funcao que receba dois numeros e retorne qual deles e o maior.
"""
n1 = int(input('Digite o primeiro numero: '))
n2 = int(input('Digite o segundo numero: '))
def maior(n1, n2):
if n1 > n2:
return f'O maior numero e: {n1}'
return f'O maior numero e: {n2}'
print(maior(n1... | StarcoderdataPython |
8165707 | <gh_stars>0
import dsfs.clustering as under_test
leaf1 = under_test.Leaf([10, 20])
leaf2 = under_test.Leaf([30, -15])
merged = under_test.Merged((leaf1, leaf2), order=1)
def test_num_differences():
assert under_test.num_differences([1, 2, 3], [2, 1, 3]) == 2
assert under_test.num_differences([1, 2], [1, 2])... | StarcoderdataPython |
1705095 | # example to understand variables
a = [2, 4, 6]
b = a
a.append(8)
print(b)
# example to understand variable scope
a = 10
b = 20
def my_function():
global a
a = 11
b = 21
my_function()
print(a) # prints11
print(b) # prints20
# example to understand the conditions
x = "one"
if x == 0:
print("F... | StarcoderdataPython |
256228 | <filename>module/user/get_msg_from_db.py<gh_stars>1-10
# !/uer/bin/env python3
# coding=utf-8
import re
from base.db_manager import mysql
from base.logger import logged, LOGGER
@logged
def get_msg_from_db(phone) -> int:
with mysql() as cur:
cur.execute('select msg from czb_message.sms_log where mobile=%s ... | StarcoderdataPython |
9691957 | import abc
import tcod
class Console(abc.ABC):
def __init__(self, x: int, y: int,
width: int, height: int) -> None:
self.x = x
self.y = y
self.width = width
self.height = height
self.console = tcod.console_new(self.width, self.height)
@abc.abstractmet... | StarcoderdataPython |
1758516 | <reponame>peshmerge/managing_big_data_practicals<gh_stars>0
"""
This computes the inverted index for a document base in /data/doina/Gutenberg-EBooks.
This program is written in Python2
To execute on a machine:
time spark-submit IINDEX-s2801620-s2449471-MKMPM.py 2> /dev/null
"""
from pyspark import SparkContext
... | StarcoderdataPython |
11211366 | import data
from pyoram import utils
FILE_NAME = 'data%d.oram'
class Stash:
def __init__(self):
if not data.is_folder(utils.STASH_FOLDER_NAME):
data.create_folder(utils.STASH_FOLDER_NAME)
def get_filename(self, data_id):
return FILE_NAME % data_id
def add_file(self, data_id,... | StarcoderdataPython |
236608 | <reponame>tristansgray/simian
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
#
"""Top level __init__ for admin package."""
import collections
import datetime
import logging
import os
import re
import urllib
import webapp2
from google.appengine.ext.webapp import template
from simian impo... | StarcoderdataPython |
3231494 | <filename>foreign/apps.py
import json
from django.apps import AppConfig
from django.contrib.auth.models import User
from .models import CrossLabQuagentUserMap
class ForeignConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'foreign'
def ready(self):
# TODO: 后期可能将这些 di... | StarcoderdataPython |
64942 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
from django.urls import reverse
import authentication.models as a
class PostCategory(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
description = models.CharField(ma... | StarcoderdataPython |
9748717 | import numpy as np
from seak import kernels
def test_single_column_kernel():
V = np.asarray([[0, 1, 2, ], [0, 1, 2], [0, 1, 2]])
G = np.asarray([[0, 1, 2], [2, 0, 1], [1, 1, 1], [0, 1, 2], [0, 0, 2]]) * 100.
i = 2
result = kernels.single_column_kernel(i, False)(G, V)
expected_result = np.asarray(... | StarcoderdataPython |
11272368 | <reponame>Oscar-Oliveira/Python3
"""
Files
"""
import os
file = open(os.path.realpath(__file__), "r")
done = False
while True:
line = file.readline()
if len(line) == 0:
break
print(line, end="")
if not done:
print("FIRST LINE AGAIN")
file.seek(0)
done ... | StarcoderdataPython |
4912063 | <gh_stars>0
"""
Libraries for calculating inter- and intramolecular interactions
"""
from automol.intmol._pot import lj_potential
from automol.intmol._pot import exp6_potential
from automol.intmol._pot import pairwise_potential_matrix
from automol.intmol._rep import low_repulsion_struct
__all__ = [
'lj_potenti... | StarcoderdataPython |
9769777 | <filename>example/tickettest/settings.py
# -*- coding: utf-8 -*-
from .settings_base import *
import platform
if platform.uname()[0] == 'Linux':
if 'ip-172-31-37-167.us-west-2.compute.internal' in platform.uname()[1]:
DOMAIN_URL = '172.16.31.10'
DEBUG = True
TIME_ZONE = 'UTC'
HTTPS_... | StarcoderdataPython |
1754111 | import os
import tvm
from tvm.contrib import cc, util
def test_add(target_dir):
n = tvm.var("n")
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
s = tvm.create_schedule(C.op)
fadd = tvm.build(s, [A, B, C], "llvm"... | StarcoderdataPython |
112090 | <gh_stars>0
#!/usr/bin/env python3
import socket
from multiprocessing.dummy import Pool
from itertools import repeat
from requests import get
from uuid import getnode
from icmplib import ping as ICMPLibPing
def portScan(localIP, port, threads = 10, timeout = 0.5):
localIP = '.'.join(localIP.split('.')[0:-1]) + '.... | StarcoderdataPython |
261855 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import os
import shutil
import subprocess
import tempfile
import sys
python_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, python_dir)
import edit_cuberite_config
from base_log_reader import BaseLogReader
PLUGIN_NAME = ... | StarcoderdataPython |
6684682 | from bank_bot.bankbot.core import bot, client_factory, safe_send_message
from bank_bot import settings
from bank_bot.banking_system import UserError, TransactionError, Database, HackerError, MessageError, AddressRecordError
# HACK_SUBSYSTEM
@bot.message_handler(commands=['hacker_help',])
def hacker_help_message(messag... | StarcoderdataPython |
12835342 |
# External module imports
import RPi.GPIO as GPIO
# Sensor that checks whether water levels have gone too low
class WaterLevelSensor:
# Store which pin receives info from the water level sensor
def __init__(self, pin):
self.pin = pin
self.is_too_low = False
# Check to see if the water le... | StarcoderdataPython |
3567783 | # Date: 06/07/2018
# Author: Pure-L0G1C
# Description: Interface for the master
from os import path
from re import match
from lib import const
from . import ssh, sftp
from hashlib import sha256
from time import time, sleep
from os import urandom, path
from threading import Thread
from datetime import datet... | StarcoderdataPython |
6461258 | <gh_stars>0
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import json
from myuw.test.api import MyuwApiTest, require_url, fdao_hfs_override
@fdao_hfs_override
@require_url('myuw_hfs_api')
class TestHFS(MyuwApiTest):
def get_hfs_api_response(self):
return self.get... | StarcoderdataPython |
3326358 | <filename>saleor/graphql/meta/types.py
import graphene
from graphene.types.generic import GenericScalar
from ...core.models import ModelWithMetadata
from ..channel import ChannelContext
from ..core.descriptions import ADDED_IN_33, PREVIEW_FEATURE
from ..core.types import NonNullList
from .resolvers import (
check_... | StarcoderdataPython |
12850401 | # Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
4859064 | <reponame>albertcrowley/srt-fbo-scraper<filename>utils/sam_utils.py
from datetime import datetime as dt
from datetime import timedelta
from io import BytesIO
import logging
import os
import sys
import zipfile
import requests
from .request_utils import requests_retry_session, get_org_request_details
logger = logging.... | StarcoderdataPython |
6647701 | from django.db.models import signals
from django.utils.functional import curry
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from django_extlog.models import ExtLog
cla... | StarcoderdataPython |
6480955 | <reponame>CGI-define-and-primeportal/trac-plugin-autocomplete<filename>autocompleteplugin/model.py
# coding: utf-8
#
# Copyright (c) 2010, Logica
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met... | StarcoderdataPython |
5119485 | <gh_stars>0
# ============================================================================
# Copyright 2021.
#
#
# Author: <NAME>
# Contact: <EMAIL>, <EMAIL>
#
#
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | StarcoderdataPython |
6474211 | import shoulder
from scapula.filter import filters
from scapula.transform import transforms
from scapula.generator.scapula_generator import ScapulaGenerator
import scapula.writer as writer
class ReadRes1Generator(ScapulaGenerator):
def setup(self, regs):
regs = shoulder.filter.filters["aarch64"].filter_... | StarcoderdataPython |
104145 | #!/usr/bin/env python
#-----------------------------------------------------------------------------
# qwiic_as6212.py
#
# Python module for the AS6212 Digital Temperature Sensor Qwiic
#
#------------------------------------------------------------------------
#
# Written by <NAME>, SparkFun Electronics, Aug 2021
#
#... | StarcoderdataPython |
114080 | from guillotina.interfaces import IAddOn
from zope.interface import implementer
@implementer(IAddOn)
class Addon(object):
""" Prototype of an Addon plugin
"""
@classmethod
def install(cls, container, request):
pass
@classmethod
def uninstall(cls, container, request):
pass
| StarcoderdataPython |
1996150 | ###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... | StarcoderdataPython |
9768276 | import subprocess
import sys
import json
import platform
import os
from crmetrics import CRBase
class CRLogs(CRBase):
def _get_container_logs(self, pod, namespace, containers, kubeconfig):
for c in containers:
container = c['name']
cmd = 'kubectl logs ' + pod + ' -n ' + namespace + ' -c ' + container + ' ' +... | StarcoderdataPython |
6526584 | <reponame>ikeikeikeike/cachers
import unittest
from cachers import FIFOCache
from . import CacheTestMixin
class FIFOCacheTest(unittest.TestCase, CacheTestMixin):
Cache = FIFOCache
def test_fifo(self):
cache = FIFOCache(maxsize=2)
cache[1] = 1
cache[2] = 2
cache[3] = 3
... | StarcoderdataPython |
4822215 | # Subject/Participant
sub='sub-01'
# Total number of experimental runs
total_run=8
# Left-out run for testing
test_run=1
# Predictor ROI
roi_1_name='FFA'
# Target ROI
roi_2_name='GM'
# Functional Data
filepath_func=[]
filepath_func+=['./example_data/'+sub+'/'+sub+'_movie_bold_space-MNI152NLin2009cAsym_preproc_denoise... | StarcoderdataPython |
3472117 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
from rest_framework import viewsets
from .serializers import programSerializer
from .models import program
class programVie... | StarcoderdataPython |
1972606 | import turtle
import math
# wasn't sure if we were allowed to use turtle.circle() so i've done it manually
# turtle configs
t = turtle.Turtle()
t.pencolor("#545454")
t.speed(0)
# helper function to move the turtle to a coordinate without drawing a line to it
def moveto(x, y):
t.penup()
t.setposition(x, y)
... | StarcoderdataPython |
11268797 | """
Compute Pi on a cluster.
It is not recommended to run this application from the IDE.
@author rambabu.posa
"""
import time
from pyspark.sql import SparkSession
from random import random
from operator import add
slices = 10
numberOfThrows = 100000 * slices
print("About to throw {} darts, ready? Stay away from t... | StarcoderdataPython |
4918962 | import os, copy
from flask_api import status
from models.main import *
from models.appendix import *
from models.segment import *
from models.prescription import *
from models.notes import ClinicalNotes
from flask import Blueprint, request
from flask_jwt_extended import (create_access_token, create_refresh_token,
... | StarcoderdataPython |
1726926 | <reponame>ShahabBakht/brain-scorer
import sys
sys.path.append('../')
from loaders import mt2
import numpy as np
import tempfile
import time
import unittest
import torch
from pprint import pprint
class TestMt2Loader(unittest.TestCase):
def test_train(self):
loader = mt2.MT2('../data_derived/crcns-mt2',
... | StarcoderdataPython |
3301735 | <filename>tools/bdf.py
"""
weegfx/tools/bdf.py: BDF font format parsing
Copyright (c) 2019 <NAME> <<EMAIL>>
Released under the 3-clause BSD license (see LICENSE)
"""
import os
import sys
import re
from typing import TextIO, List, Iterable, Any, Callable
from font import row_width, BBox
def bdf_width(width: int) -> ... | StarcoderdataPython |
3244481 | """Utilities for CLIs."""
from argparse import ArgumentTypeError
from json import loads
def json_arg(value: str):
"""
Parse a JSON argument from the command line.
>>> json_arg('{"foo": "bar", "baz": [1, 2]}')
{'foo': 'bar', 'baz': [1, 2]}
>>> json_arg('{')
Traceback (most recent call last):
... | StarcoderdataPython |
3213842 | <reponame>ffreemt/gpt3-api
"""Test gpt3_api."""
from gpt3_api import __version__
from gpt3_api import gpt3_api
def test_version():
"""Test version."""
assert __version__ == "0.1.0"
def test_sanity():
"""Sanity check."""
try:
assert not gpt3_api()
except Exception:
assert True
| StarcoderdataPython |
1802715 | <reponame>malaiwah/ocpp
"""Constants for ocpp tests."""
from custom_components.ocpp.const import (
CONF_CPID,
CONF_CSID,
CONF_HOST,
CONF_METER_INTERVAL,
CONF_MONITORED_VARIABLES,
CONF_PORT,
)
from ocpp.v16.enums import Measurand
MOCK_CONFIG = {
CONF_HOST: "127.0.0.1",
CONF_PORT: 9000,
... | StarcoderdataPython |
5178255 | <reponame>remytuyeras/pedigrad-library<filename>Pedigrad_py/PartitionCategory/efp.py
#------------------------------------------------------------------------------
#_epi_factorize_partition(partition): list
#------------------------------------------------------------------------------
'''
This function relabels the e... | StarcoderdataPython |
1707422 | const_T = Hyper()
const_M = Hyper()
@Runtime([const_M, const_M, const_M], const_M)
def Update(prev, cur, offset):
return (prev + cur + offset) % 2
offset = Param(const_M)
do_anything = Param(2)
initial_tape = Input(const_M)[2]
tape = Var(const_M)[const_T]
for t in range(2):
tape[t].set_to(initial_tape[t])
... | StarcoderdataPython |
342236 | # Copyright 2021 The Distla 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 applicable ... | StarcoderdataPython |
11264759 | <reponame>ostrokach/proteinsolver<filename>proteinsolver/dashboard/ps_process.py
from __future__ import annotations
import logging
import multiprocessing as mp
from queue import Queue
from typing import Union
import torch
from proteinsolver.dashboard.msa_view import MSASeq
from proteinsolver.utils import array_to_se... | StarcoderdataPython |
11253938 | import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from utils import choose
class ConvNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
... | StarcoderdataPython |
11281380 | <reponame>najuzilu/CDW-AWSRedshift<filename>sql_queries.py
import configparser
# CONFIG
config = configparser.ConfigParser()
config.read("dwh.cfg")
SCHEMA_NAME = config.get("AWS", "SCHEMA_NAME")
# DROP TABLES
staging_events_table_drop = "DROP TABLE IF EXISTS staging_events;"
staging_songs_table_drop = "DROP TABLE I... | StarcoderdataPython |
8033411 | from spt3g.core.load_pybindings import load_pybindings
load_pybindings(__name__, __path__)
from .ARCExtractor import UnpackACUData, UnpackTrackerData, DecryptFeatureBit, ARCExtract, ARCExtractMinimal
from .ARCHKExtractor import UnpackSPTpolHKData
from .GCPDataTee import GCPHousekeepingTee, GCPSignalledHousekeeping, GC... | StarcoderdataPython |
5143285 | """Computational models of the retina, such as phosphene and neural response models.
.. autosummary::
:toctree: _api
base
scoreboard
axon_map
watson2014
"""
from .base import BaseModel, NotBuiltError
from .watson2014 import (Watson2014ConversionMixin, dva2ret, ret2dva,
Wa... | StarcoderdataPython |
8007514 | class Node:
def __init__(self):
self.parent = None
self.rank = 0
self.name = None
class DS:
def __init__(self):
self.top = Node()
self.top.parent = self.top
self.top.rank = 0
self.top.name = "rep"
self.array = []
def makeset(self, name):
... | StarcoderdataPython |
3393894 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from collections import OrderedDict
from torch.nn import init
from model.utils.layers import Shuffle3x3, Shuffle5x5
# Dual-shuffle Residual Block (DRB)
class DRB(nn.Module):
def __init__(s... | StarcoderdataPython |
5159288 | """
Contains configuration data for interacting with the source_data folder.
These are hardcoded here as this is meant to be a dumping
ground. Source_data is not actually user configurable.
For customized data loading, use mhwdata.io directly.
"""
from decimal import Decimal
supported_ranks = ('LR', 'HR')
"A mappi... | StarcoderdataPython |
6488782 | <filename>tools/xml_chip_filter.py
#! /usr/bin/python3
import sys
import argparse
import xml_utils as u
import datetime
import pdb
from collections import defaultdict
##------------------------------------------------------------
## xml_chip_nose_filter *.xml dirs
## given x, y, dist: return noses within dist of ... | StarcoderdataPython |
8170707 | import numpy as np
import librosa, math
from hparams import hparams as hp
def load_wav(filename):
x = librosa.load(filename, sr=hp.sample_rate)[0]
return x
def save_wav(y, filename) :
librosa.output.write_wav(filename, y, hp.sample_rate) | StarcoderdataPython |
4801220 | <gh_stars>0
from pyspark.sql import SparkSession
from pyspark.sql.functions import when, col
def main():
spark = SparkSession.builder.master("local[2]").appName("change_seat").getOrCreate()
path = "data/seat.csv"
df_seat = spark.read.option("header", "true").csv(path)
df_seat.show()
df_seat.printS... | StarcoderdataPython |
3490722 | # Generated by Django 2.2.24 on 2021-07-30 14:49
import logging
import core.validators
import django.contrib.postgres.fields.jsonb
from django.db import migrations
logger = logging.getLogger(__name__)
schema = {'items': [{'properties': {'bbox': {'items': [{'contains': {'type': 'number'}, 'maxItems': 2, 'minItems': 2... | StarcoderdataPython |
3353174 | <reponame>danielbrenners/buzz-lightyear<filename>pi/emo_reco/helpers/nn/mxconv/__init__.py<gh_stars>0
# import the necessary packages
from .mxalexnet import MxAlexNet
from .mxvggnet import MxVGGNet
from .mxgooglenet import MxGoogLeNet
from .mxresnet import MxResNet
from .mxsqueezenet import MxSqueezeNet | StarcoderdataPython |
9736425 | <filename>react-flask-app/api/trip.py<gh_stars>0
import time
class Trip:
startTime = time.strftime('%A %B, %d %Y %H:%M:%S')
nSnaps = 0
tripDuration = 0
avSpeed = 0
avRPM = 0
avEngineLoad = 0
avCoolantTemp = 0
avThrottlePos = 0
snaps = []
def __init__(self):
self.startT... | StarcoderdataPython |
6628613 | # Native Modules
import requests # For making HTTP requests
# External Modules
from bs4 import BeautifulSoup # BeautifulSoup is a webscraping module
# Classes
import cmd_args # Global commandline arguments
from link import Link ... | StarcoderdataPython |
1604756 | <reponame>dlshriver/dnnf<gh_stars>0
from __future__ import annotations
import itertools
import logging
from abc import ABC, abstractmethod
from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Type, Union
import numpy as np
from dnnv.nn import OperationGraph, OperationTransformer
from dnnv.nn.utils... | StarcoderdataPython |
4913816 | #####################################################################
# #
# /labscript_devices/PrawnBlaster/runviewer_parsers.py #
# #
# Copyright 2021, <NAME> ... | StarcoderdataPython |
1691057 | # Copyright 2021 Ringgaard Research ApS
#
# 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... | StarcoderdataPython |
9736475 | <filename>openquake.hazardlib/openquake/hazardlib/gsim/douglas_stochastic_2013.py
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public Lic... | StarcoderdataPython |
261985 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
SUSY_HLT_InclusiveHT_800 = cms.EDAnalyzer("SUSY_HLT_InclusiveHT",
trigSummary = cms.InputTag("hltTriggerSummaryAOD"),
pfMETCollection = cms.InputTag("pfMet"),
pfJetCollection = cms.InputTag("ak4PFJetsCHS"),
calo... | StarcoderdataPython |
1795653 | import os
import argparse
import random
from tqdm import tqdm
import logging
from typing import Dict
logger = logging.getLogger(__name__)
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Sample Sentences from monolingual corpora to train tokenizer")
parser.add_argume... | StarcoderdataPython |
344774 | # -----------------------------------------------------
# Initial Settings for the Project
#
# Author: <NAME>
# Creating Date: May 29, 2018
# Latest rectifying: Jun 5, 2018
# -----------------------------------------------------
import sys
import time
import functools
# import matplotlib
def clock_non_return(func):
... | StarcoderdataPython |
4938374 | <filename>scrips/search_eval/run_selfcenter_eval_search.py<gh_stars>0
import os
import sys
import prody as pr
import numpy as np
#You can either add the python package path.
#sys.path.append(r'/mnt/e/GitHub_Design/Metalprot')
from metalprot.search import search, search_eval
from metalprot.basic import filter
import pic... | StarcoderdataPython |
3330914 |
#!/usr/bin/env python3
"""
Model representation of a docheading type Element from doxygen
<xsd:complexType name="docHeadingType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
</xsd:complexType>
"""
... | StarcoderdataPython |
8078115 | <filename>speed_challenge.py
import cv2
import os
import sys
import numpy as np
from sklearn import linear_model
import queue
from tools import movingAverage, plot, computeAverage
import matplotlib.pyplot as plt
class Speed_Car():
def __init__(self, video_train_path, text_train_path, video_test_path):
# T... | StarcoderdataPython |
1975733 | <reponame>zainhussaini/salat
from time import daylight
import salat
import datetime as dt
import math
import pytz
KAABAH_LONG_LAT = (39.8262, 21.4225)
EPOCH = dt.date(2000, 1, 1)
TIMEZONES = [
dt.timezone.utc,
dt.timezone(dt.timedelta(), "UTC"),
dt.timezone(dt.timedelta(hours=3), "AST"),
dt.timezone(d... | StarcoderdataPython |
154895 | <reponame>dbms-ctzs/sage
from django.http import HttpResponse
from django.shortcuts import redirect
# Unauthenticated user will be redirected >> "home"
def unauthenticated_user(view_func):
def wrapper_func(request,*args,**kwargs):
if request.user.is_authenticated:
return redirect('home')
... | StarcoderdataPython |
8169102 | <reponame>sky-dust-intelligence-bv/nni
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
import itertools
from typing import Any, Dict, List, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from nni.algorithms.compression.v2.pytorch.base import Pruner
from nni... | StarcoderdataPython |
5168421 | import json
import datetime
import boto3
def lambda_handler(event, context):
ec2 = boto3.resource('ec2')
# create a new EC2 instance
instances = ec2.create_instances(
ImageId='ami-09d95fab7fff3776c',
MinCount=1,
MaxCount=1,
InstanceType='... | StarcoderdataPython |
1717946 | <filename>cs220/fall_2015/code_examples/trapezoidal_rule/trap.py<gh_stars>1-10
# File: trap.py
# Purpose: Calculate area using trapezoidal rule.
#
# Input: a, b, n
# Output: estimate of area between x-axis, x = a, x = b, and graph of f(x)
# using n trapezoids.
#
# Usage: python trap.py
#
# Note: The... | StarcoderdataPython |
11353286 | from abc import ABC, abstractmethod
from datetime import datetime
class ECGController(ABC):
def __init__(self, dir_name, file_name, file_list):
self.dir_name = dir_name
self.file_name = file_name
self.file_list = file_list
@property
def full_name(self):
return f"{self.dir_n... | StarcoderdataPython |
9628449 |
import logging
import traceback
from queue import SimpleQueue
from confluent_kafka.avro.serializer import SerializerError
# from confluent_kafka.avro import AvroConsumer
import json
from confluent_kafka import KafkaError, Consumer as KafkaConsumer
class Consumer:
def __init__(self, broker, schema_registry, topi... | StarcoderdataPython |
9708282 | price_list: dict = {
'coffee':{
'Sofia': 0.5,
'Plovdiv': 0.4,
'Varna': 0.45,
},
'water':{
'Sofia': 0.8,
'Plovdiv': 0.7,
'Varna': 0.7,
},
'beer':{
'Sofia': 1.2,
'Plovdiv': 1.15,
'Varna': 1.1,
},
'sweets':{
'Sofia'... | StarcoderdataPython |
6659827 | #!/usr/bin/env python3
import os
import sys
import time
import zmq
# _______
# |== []|
# | ==== | *letterbox*
# '-------'
#
# timer - timer and reminder services
# written by <NAME>, 2019-2020 (jclemme at my dot uri dot edu)
| StarcoderdataPython |
1893011 | <reponame>jobevers/vex
import sys
class InvalidArgument(Exception):
"""Raised by anything under main() to propagate errors to user.
"""
def __init__(self, message):
self.message = message
Exception.__init__(self, message)
class NoVirtualenvName(InvalidArgument):
"""No virtualenv name... | StarcoderdataPython |
5097570 | import pandas as pd
cols_to_keep = ['name', 'a', 'e', 'i', 'om', 'w', 'q', 'ad', 'per_y', 'data_arc',
'condition_code', 'n_obs_used', 'H', 'neo', 'pha', 'diameter',
'albedo', 'rot_per', 'moid', 'class', 'n', 'per', 'ma']
def clean(main_csv):
df = pd.read_csv(main_csv, header=0, us... | StarcoderdataPython |
156783 | <reponame>ulgltas/ModalSolver
#!/usr/bin/env python3
# -*- coding: utf8 -*-
# test encoding: à-é-è-ô-ï-€
#
# run script for Modal Solver
def createWdir():
import os
wdir = os.path.join(os.getcwd(), 'workspace')
if not os.path.isdir(wdir):
print("creating", wdir)
os.makedirs(wdir)
os.chd... | StarcoderdataPython |
12857255 |
import numpy as np
from tqdm import tqdm
from scipy.sparse import csr_matrix, hstack, vstack
from sklearn.neighbors import NearestNeighbors
class MFKnn(object):
"""
Implementation of
"""
def __init__(self, metric, k):
self.k = k
self.metric = metric
def fit(self, X, y):
#
self.X_train = X
self.y_tr... | StarcoderdataPython |
6509055 | <reponame>lsandov1/arm-qa-tools
#!/usr/bin/env python3
__copyright__ = """
/*
* Copyright (c) 2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
"""
""" tfa_generate_influxdb_files.py:
Parses the TF-A metrics summary files and generates JSON files
containing data to ... | StarcoderdataPython |
54692 | <filename>turq/editor.py<gh_stars>10-100
# pylint: disable=unused-argument
import base64
import hashlib
import html
import mimetypes
import os
import pkgutil
import posixpath
import socket
import socketserver
import string
import threading
import wsgiref.simple_server
import falcon
import werkzeug.formparser
import ... | StarcoderdataPython |
1644192 | #
# Copyright 2016 <NAME> for Puppet 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 i... | StarcoderdataPython |
212209 | <reponame>ryankanno/vor
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .base import PhoneNumberProvider
class UsPhoneNumberProvider(PhoneNumberProvider):
def __init__(self, *args, **kwargs):
super(PhoneNumberProvider, self).__init__(*args, **kwargs)
def get_phone_number(self):
raise NotI... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.