id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6480340 | <filename>otp/level/DistributedInteractiveEntityAI.py
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedInteractiveEntityAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedInteractiveEnti... | StarcoderdataPython |
8038791 | #!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import datetime
import inspect
import logging
import os
import random
import sys
import unittest
ROOT_DIR = os.path.dirname(os.pat... | StarcoderdataPython |
5113565 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import unittest
from stormshield.sns.sslclient import SSLClient
APPLIANCE = os.getenv('APPLIANCE', "")
PASSWORD = os.getenv('PASSWORD', "")
@unittest.skipIf(APPLIANCE=="", "APPLIANCE env var must be set to the ip/... | StarcoderdataPython |
8049103 | #!/usr/bin/env python
import time
import math
from common import Common
from metnum.helpers.run_function import run_function
class LinearInterpolation(Common):
def __init__(self, argv):
if len(argv) < 2:
raise Exception('Must have 2 points')
self.x_low, self.y_low = [float(x) for x i... | StarcoderdataPython |
12841636 | <gh_stars>0
from enum import Enum
import os
import sys
import inspect
import logging
import datetime
currentdir = os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from Utils.Utils import Actions
class Trade():
de... | StarcoderdataPython |
4904944 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer.base_layer import TrainableLayer
from niftynet.utilities.util_common import look_up_operations
def prelu(f_in, channelwise_params):
pos = tf.nn.relu(f_in)
neg = channelwise_params * (f_... | StarcoderdataPython |
296292 | <filename>21 - ML/DataScience1/script.py
# Use Google Colab
import seaborn as sns
from bokeh.models import HoverTool
from bokeh.plotting import figure, show
import pandas as pd
data_frame = pd.read_csv('data.csv')
data_frame.shape
data_frame.describe()
data_frame.values
df1 = pd.DataFrame(data_frame, columns=['Name',... | StarcoderdataPython |
1819139 | # Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | StarcoderdataPython |
262375 | #
# LOFAR Transients Key Project
"""
General purpose astronomical coordinate handling routines.
"""
import sys
import math
from astropy import wcs as pywcs
import logging
import datetime
import pytz
from casacore.measures import measures
from casacore.quanta import quantity
logger = logging.getLogger(__name__)
# No... | StarcoderdataPython |
12845915 | <reponame>jml/pyhazard
# Copyright (c) 2015 <NAME> <<EMAIL>>
#
# 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 applicab... | StarcoderdataPython |
9601411 | #!/usr/bin/env python
import os
import re
import sys
ORDERING_FIELD = "propertyOrder"
SCHEMA_DIRECTORY = "schemas"
class OrderingGenerator(object):
def __init__(self, field, start=0, incr=10):
self.field = field
self.count = start
self.incr = incr
def __call__(self, match):
... | StarcoderdataPython |
9634749 | <gh_stars>0
#!/usr/bin/env python
# A basic test that checks that we can build a simple makefile.
makefile = '''
{
"rules":
[
{
"inputs": [ "output" ],
"outputs": [ "all" ]
},
{
"inputs": [ "node1", "node2" ],
"outputs": [ "output" ],
"cmd": "cat node1 > output && cat n... | StarcoderdataPython |
3260547 | #encoding=utf-8
import codecs
import os
import sys
from os import path
import subprocess
import traceback
import urllib
from urlparse import urlparse
def RedIt(s):
if(sys.__stderr__.isatty()):
return "\033[1;31;40m%s\033[0m"%(s)
else:
return s
def GreenIt(s):
if(sys.__stderr__.isatty())... | StarcoderdataPython |
6698550 | <reponame>MartinHeinz/IoT-Cloud<gh_stars>10-100
from random import randint
import pytest
from pyope.ope import OPE
from client.crypto_utils import instantiate_ope_cipher
@pytest.fixture(scope="module", autouse=True)
def cipher():
random_key = OPE.generate_key()
c = instantiate_ope_cipher(random_key)
ret... | StarcoderdataPython |
394339 | # MOCKS for autodoc
import quantities as pq
if pq.mV.__class__.__module__ == 'sphinx.ext.autodoc.importer':
pq.mV = pq.ms = pq.Hz = pq.nA = 1.0
# END MOCKS
from abc import abstractmethod
from neuronunit import capabilities as ncap
from neuronunit.tests.base import VmTest
from olfactorybulb.neuronunit.te... | StarcoderdataPython |
1977109 | # coding: utf-8
import socket
import threading
import logging
import pickle
from utils import *
import queue
import time
class Node(threading.Thread):
def __init__(self, id, address, name, successor_addr, timeout=1):
threading.Thread.__init__(self)
self.id = id
self.address = address
... | StarcoderdataPython |
8119755 | from ..config import config
class TemplateParser:
"""TemplateParser.
Helper class to extract useful information from Wiki templates
All methods are static
"""
@staticmethod
def is_citation(t):
"""is_citation_template.
Predicate: Determines if a template qualifies as a "citation... | StarcoderdataPython |
6534136 | import os
import torch
class Dictionary(object):
def __init__(self):
self.word2idx = {}
self.idx2word = []
def add_word(self, word):
if word not in self.word2idx:
self.idx2word.append(word)
self.word2idx[word] = len(self.idx2word) - 1
return self.word2i... | StarcoderdataPython |
6400690 |
### BIFS class ###
### ###
### Class for performing Bayesian Image ###
### Restoration in Fourier Space (BIFS) ###
## The filename is bifscore, not bifs or BIFS to avoid trouble
## with the im... | StarcoderdataPython |
3334228 | #The MIT License (MIT)
#
#Copyright (c) 2016 <NAME>
#
#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
#to use, copy, modify, merge, p... | StarcoderdataPython |
6509619 | <gh_stars>10-100
""" The Proxy Pattern
Notes:
As the name suggests, the pattern involves creating a proxy or an intermediary
interface between an object or service and its user. The proxy allows the user
to access the object or service through it, while adding the possibility to
wrap calls with additional functionali... | StarcoderdataPython |
8174966 | # -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import torch
PotentialNet_PDBBind_core_pocket_random = {
'dataset': 'PDBBind',
'subset': 'core',
'load_binding_pocket': True,
'random_seed': 123,
... | StarcoderdataPython |
295309 | from sklearn.svm import SVC as _SVC
from dlex.configs import Params
class SVC(_SVC):
def __init__(self, params: Params, dataset):
super().__init__(
gamma='scale',
kernel=params.model.kernel or 'rbf')
self.params = params
def score(self, X, y, metric="acc"):
if... | StarcoderdataPython |
265707 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import logging
from bs4 import Tag
from lncrawl.core.crawler import Crawler
logger = logging.getLogger(__name__)
search_url = '%s/?s=%s&post_type=wp-manga&author=&artist=&release='
class BoxNovelCrawler(Crawler):
base_url = [
'https://boxnovel.com/',
]
d... | StarcoderdataPython |
4810278 | <reponame>imaroger/sot-talos-balance
from __future__ import print_function
import numpy as np
from numpy.testing import assert_almost_equal as assertApprox
from sot_talos_balance.euler_to_quat import EulerToQuat
from sot_talos_balance.pose_quaternion_to_matrix_homo import PoseQuaternionToMatrixHomo
from sot_talos_bal... | StarcoderdataPython |
11343525 | <reponame>rbotter/pyDEA
''' This module contains classes responsible for updating solution progress.
'''
class NullProgress(object):
''' This class does not update solution progress. It is used in
terminal application.
'''
def set_position(self, position):
''' Does nothing.
'''
... | StarcoderdataPython |
211818 | <gh_stars>0
from datetime import datetime
from logging import getLogger
from typing import Any, Dict, List, Optional, Tuple
from hs_build_tools.pytest import assert_text
from hashkernel import Jsonable
from hashkernel.mold import Flator, FunctionMold, Mold
from hashkernel.smattr import SmAttr
log = getLogger(__name_... | StarcoderdataPython |
11343716 | # -*- coding: utf-8 -*-
# Copyright 2016-2020 CERN
#
# 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 |
6520881 | # coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | StarcoderdataPython |
11341086 | <reponame>benjyw/materiality.commons
# coding=utf-8
# Copyright 2016 Materiality Labs.
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from django.conf import settings
from django.contrib.staticfiles.man... | StarcoderdataPython |
5050671 | <filename>src/qutip_cupy/expectation.py
"""Contains specialization functions for calculating expectation."""
import cupy as cp
def expect_cupydense(op, state):
"""
Get the expectation value of the operator `op` over the state `state`. The
state can be either a ket or a density matrix.
The expectati... | StarcoderdataPython |
12813235 | <filename>config/helpers.py
import random
import string
from config import mails
import sendgrid
import os
from sendgrid.helpers.mail import *
def random_string(length):
pool = string.ascii_uppercase + string.ascii_lowercase + string.digits
return ''.join(random.choice(pool) for i in range(length))
def sendM... | StarcoderdataPython |
6628445 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: latin-1 -*-
combien_de_departements = {
'Auvergne-Rhônes-Alpes': 12,
'Île-de-France': 8,
'Normandie': 5,
'Provence-Alpes-Côte d\'Azur': 8,
'Nouvelle-Aquitaine': 12,
... | StarcoderdataPython |
9740699 | <gh_stars>0
# Copyright 2018 Luddite Labs 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 t... | StarcoderdataPython |
9606490 | import numpy as np
import gensim
from numba import njit
from gensim.models import Word2Vec
from distutils.version import LooseVersion
from sklearn.linear_model import LogisticRegression
from graphgallery import functional as gf
from graphgallery.gallery import Common
from .sklearn_model import SklearnModel
@Common.... | StarcoderdataPython |
5113218 | <filename>simstat/bootstrapTest.py<gh_stars>0
from . import bootstrap
import numpy as np
__all__=['bootstrapTest'] #everything that will be imported by import *, like in __init__
def bootstrapTest(data,n=10000):
"""
Wrapper for 'bootstrap'
input: data: 1D ndarray
output: whether 'data's bootstrap dist... | StarcoderdataPython |
1959250 | <filename>mcradar/radarOperator/zeOperator.py
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import subprocess
import numpy as np
import xarray as xr
from glob import glob
from pytmatrix.tmatrix import Scatterer
from pytmatrix import psd, orientation, radar
from pytmatrix impor... | StarcoderdataPython |
3506092 | <reponame>mobergd/interfaces
""" fit rate constants to Arrhenius expressions
"""
import os
import numpy as np
from scipy.optimize import leastsq
from ratefit.fit.arrhenius import dsarrfit_io
RC = 1.98720425864083e-3 # Gas Constant in kcal/mol.K
def single(temps, rate_constants, t_ref, method,
a_guess=8... | StarcoderdataPython |
6506365 | <reponame>ElLorans/PythonCrashCourse<gh_stars>1-10
##write a function that takes a string and a name as arguments
##and creates a file name.txt with the given string
def write(string, name):
with open(name, 'w') as file: # ALWAYS use the with method to open a file
# 'w' stands for 'writi... | StarcoderdataPython |
6653581 | import os.path
import unittest
import clrypt.openssl
TEST_CERT_DIR = os.path.join(os.path.dirname(__file__), 'test-cert')
class TestBignumToMPI(unittest.TestCase):
"""Make sure we're encoding integers correctly."""
def test_exponent(self):
self.assertEqual(
clrypt.openssl.bignum_to_mpi... | StarcoderdataPython |
6401542 | <gh_stars>0
from django.views.generic import TemplateView
from django.views.decorators.cache import never_cache
from rest_framework import viewsets, status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.renderers import JSONRenderer
from rest_framework.v... | StarcoderdataPython |
6528151 | <gh_stars>0
class Configuration(object):
#_server=None
#_user=None
def __init__(self, server="http://localhost", port=8080, application_context="/sbml4j", user="sbml4j"):
self._server = server
self._port = port
self._application_context = application_context
print("Serve... | StarcoderdataPython |
9611667 | from django.db import models
from customer import models as customer_models
class Invoice(models.Model):
name = models.ForeignKey(customer_models.Customer, on_delete=models.CASCADE)
balance = models.IntegerField(null=True)
| StarcoderdataPython |
6545839 | <filename>MillerArrays/millerArrayCountBijvoetPairs.py<gh_stars>0
miller_arrays[0].n_bijvoet_pairs()
| StarcoderdataPython |
3418051 | """
This script adversarially trains a model using iterative attacks on multiple
GPUs.
"""
# pylint: disable=missing-docstring
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from collections import name... | StarcoderdataPython |
386881 | <reponame>ShiNik/wiki_ml
# user define imports
from my_package.factory import ParserGenerator as ParserGenerator
from my_package import wiki_extractor as extractor
from my_package import util as util
from my_package.database_manager import DatabaseManager
from my_package.parser import TableParser
from my_package.log_ma... | StarcoderdataPython |
9790921 | """ Test Jupyter notebooks with examples
:Author: <NAME> <<EMAIL>>
:Date: 2019-02-20
:Copyright: 2019, Karr Lab
:License: MIT
"""
import glob
import itertools
import json
import nbconvert.preprocessors
import nbformat
import os
import requests
import shutil
import sys
import tempfile
import unittest
try:
respons... | StarcoderdataPython |
3588357 | <gh_stars>0
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
htEfficiency = DQMEDHarvester("DQMGenericClient",
subDirs = cms.untracked.vstring("HLT/JME/HT/*"),
verbose = cms.untracked.uint32(0), # Set to 2 for all messages
resolution = cm... | StarcoderdataPython |
4901447 | <filename>memomodel/memo_objects.py
import collections
from memodb import h5db
import enum
import yaml
import numpy
import pandas
class SimConfig(h5db.H5DBObject, yaml.YAMLObject):
yaml_tag = '!SimConfig'
arguments = h5db.ObjectList
class VirtualState(h5db.H5DBObject, yaml.YAMLObject):
yaml_tag = '!Virt... | StarcoderdataPython |
11294158 | import numpy as np
from pysteps import motion, nowcasts
from pysteps.utils import conversion, transformation
import tensorflow as tf
oflow_method = motion.get_method("LK")
extrap_method = nowcasts.get_method("extrapolation")
def motion_extrapolate(motion_field, extrap_field, num_frames=12):
V = oflow_method(motio... | StarcoderdataPython |
4827364 | import rfidsecuritysvc.exception as exception
from rfidsecuritysvc.api import RECORD_COUNT_HEADER
from rfidsecuritysvc.model import guest as model
def get(id):
m = model.get(id)
if m:
return m.to_json()
return f'Object with id "{id}" does not exist.', 404
def search():
results = []
for m... | StarcoderdataPython |
3365367 | <filename>move_comments.py
#!/usr/bin/env python3
# move_comments.py
from pathlib import Path
# from dataclasses import dataclass, field, Field
p = Path('.')
script_path = Path(__file__).resolve().parents
here = Path().cwd()
print(f"script location: {str(script_path[0]):<55.55}")
print(f"current path: {str(he... | StarcoderdataPython |
4817840 |
from nose.tools import *
import numpy as np
import pandas as pd
from .. import pvl_pres2alt
def test_proper():
alt=pvl_pres2alt.pvl_pres2alt(pressure=222)
assert(alt>0)
alt=pvl_pres2alt.pvl_pres2alt(pressure=[222,4434,32453,212])
assert(np.size(alt)>1)
#include physical checks
@raises(Exception)
def test_fail(... | StarcoderdataPython |
189808 | # -*- coding: utf-8 -*-
from django.conf.urls import url, include
from users.views import LoginView, LogoutView
urlpatterns = [
url(r'^login/$', LoginView.as_view(), name='user_login'),
url('^logout/$', LogoutView.as_view(), name="logout"),
]
| StarcoderdataPython |
1680739 |
import os
import numpy as np
path_praat_script=os.path.dirname(os.path.abspath(__file__))
def multi_find(s, r):
"""
Internal function used to decode the Formants file generated by Praat.
"""
s_len = len(s)
r_len = len(r)
_complete = []
if s_len < r_len:
n = -1
else:
for... | StarcoderdataPython |
3475345 | <filename>__init__.py
__about__ = """
Django Packages is a directory of reusable apps, sites, tools, and more for your Django projects.
"""
| StarcoderdataPython |
9734854 | <filename>src/clikraken/api/private/list_open_orders.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
clikraken.api.private.list_open_orders
This module queries the OpenOrders method of Kraken's API
and outputs the results in a tabular format.
Licensed under the Apache License, Version 2.0. See the LICENSE file.
"""
impor... | StarcoderdataPython |
3472718 | <filename>resolwe/permissions/filters.py
""".. Ignore pydocstyle D400.
==================
Permissions Filter
==================
"""
from rest_framework.filters import BaseFilterBackend
from resolwe.permissions.utils import model_has_permissions
class ResolwePermissionsFilter(BaseFilterBackend):
"""Permissions ... | StarcoderdataPython |
9795812 | #!/usr/bin/python
import sys
import time
import RPi.GPIO as GPIO
import os
import json
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
teramon_dir = os.path.dirname(os.path.realpath(__file__))
json_data = open(teramon_dir + "/teramon.json").read()
config = json.loads(json_data)
data_raw = open(config['measurement_sa... | StarcoderdataPython |
6543382 | <filename>backend/polls/models.py<gh_stars>1-10
import datetime
from django.db import models
from django.utils import timezone
# from django.contrib.auth.models import User
class Word(models.Model):
word = models.CharField(max_length=200)
freq = models.FloatField()
length = models.IntegerField()
def... | StarcoderdataPython |
8007052 | <reponame>Oorzhakau/TeamForce_bot
"""Загрузка переменных окружения."""
from environs import Env
env = Env()
env.read_env()
BOT_TOKEN = env.str("BOT_TOKEN")
ADMIN = env.int("ADMIN")
DEBUG = env.list("DEBUG")
DJANGO_ALLOWED_HOSTS = env.str("DJANGO_ALLOWED_HOSTS")
SECRET_KEY = env.str("SECRET_KEY")
POSTGRES_DB = env.... | StarcoderdataPython |
301049 | <reponame>richardycao/hummingbird_python
class PipelineNode(object):
def __init__(self, module_path, params):
self.module_path = module_path
self.params = params
| StarcoderdataPython |
6587151 | import json
import requests
import urllib.parse
from django.conf import settings
from rest_framework.exceptions import ValidationError
class ClashRoyaleAPI(object):
"""皇室战争API"""
def __init__(self):
# 'Accept': '*/*' 默认
self.host = 'https://api.clashroyale.com/v1'
if settings.DEBUG:
... | StarcoderdataPython |
11304676 | <gh_stars>0
from .. import db
from .. import bcrypt
import datetime
# from app.main.models.blacklist import BlacklistToken
from app.main.models.Flat import Flat
from app.main.models.Society import Society
from ..config import key
import jwt
from flask_bcrypt import generate_password_hash, check_password_hash
class U... | StarcoderdataPython |
1821538 | <filename>vega/search_space/fine_grained_space/networks/__init__.py
from .mobilenetV3tiny import MobileNetV3Tiny
from .resnet import *
from .sr import *
| StarcoderdataPython |
11203620 | <reponame>iorala/PYTH1
# Übungen zu Konditionen
# 1. Gerade und Ungerade
print("1. Gerade und Ungerade")
#
# Schreiben Sie ein Programm, das eine ganze Zahl vom Benutzer liest. Dann sollte Ihr Programm eine Meldung anzeigen,
# die angibt, ob die ganze Zahl gerade oder ungerade ist.
zahl = int(input("Geben Sie eine Z... | StarcoderdataPython |
3242163 | <gh_stars>0
import time
def test_is_opencart_works(get_driver):
browser = get_driver
time.sleep(5)
assert browser.find_elements_by_xpath('//h1/a[text()="Your Store"]')
| StarcoderdataPython |
4874275 | <filename>FBA_tutorials/utils/flux_pie_plot_function.py
# coding: utf-8
# In[ ]:
def flux_pie_plot(df):
import pandas as pd
import numpy as np
from math import log, sqrt
from collections import OrderedDict
from bokeh.plotting import figure, show, output_notebook
from bokeh.palettes im... | StarcoderdataPython |
8189163 | import factory.random
import pytest
from rest_framework.test import APIClient
from signups.tests.factories import SignupFactory, SignupTargetFactory, UserFactory
@pytest.fixture(autouse=True)
def no_more_mark_django_db(transactional_db):
pass
@pytest.fixture(autouse=True)
def set_random_seed():
factory.ran... | StarcoderdataPython |
11295153 | #!/usr/bin/python3
import os
import subprocess
class ANTS_Route():
def __init__(self, server_ip, client_ip):
# Set a default server ip if none is given
if server_ip == None:
self.server_ip = "10.1.1.120"
else:
self.server_ip = server_ip
# Set a default cl... | StarcoderdataPython |
1890693 | <reponame>basilboli/tagli<gh_stars>0
# CONFIGURATION FILE
DEBUG = True
DATABASE = "tagli"
SECRET = "tagli"
GOOGLE_MAP_KEY = "BLABLA"
TWITTER = dict(
consumer_key='',
consumer_secret=''
)
EMAIL_FROM="BLABLA"
MAIL_SERVER = "smtp.gmail.com"
MAIL_PORT = 465
MAIL_USE_TLS = False
MAIL_USE... | StarcoderdataPython |
1972813 | """
Created on Fri March 22, 2019
@author: <NAME>
"""
import scipy.io.wavfile
import numpy as np
from sklearn import preprocessing
if __name__ == "__main__":
"""
Script that gets the raw audio from the IEMOCAP dataset. Should be executed only once to get the FC_raw_audio.csv
file, which contains the id... | StarcoderdataPython |
3557741 | <filename>devkit_road/python/simpleExample_generateBEVResults.py
#!/usr/bin/env python
#
# THE KITTI VISION BENCHMARK SUITE: ROAD BENCHMARK
#
# File: simpleExample_transformTestResults2BEV.py
#
# Copyright (C) 2013
# Honda Research Institute Europe GmbH
# Carl-Legien-Str. 30
# 63073 Offenbach/Main
# Germany
#
# ... | StarcoderdataPython |
3218366 | <gh_stars>10-100
import numpy as np
import tensorflow as tf
import itertools
import math
class TFStringKernel(object):
"""
Code to run the SSK of Moss et al. 2020 on a GPU
"""
def __init__(self, _gap_decay=1.0, _match_decay=1.0,batch_size=1000,
_order_coefs=[1.0], alphabet = [], max... | StarcoderdataPython |
3431756 | <filename>sara_flexbe_states/src/sara_flexbe_states/Look_at_sound.py
#!/usr/bin/env python
from flexbe_core import EventState, Logger
import rospy
from geometry_msgs.msg import PoseStamped
from tf.transformations import euler_from_quaternion
from flexbe_core.proxy import ProxySubscriberCached
from flexbe_core.proxy im... | StarcoderdataPython |
8119791 | from django.shortcuts import render
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.decorators import action
from .models import Collection
from .serializers import CollectionSerializer
from users.models import User
from u... | StarcoderdataPython |
3536946 | <reponame>alexdawn/risk
from typing import Callable, Any, Tuple, Dict, List
from itertools import product, chain
from functools import lru_cache
import warnings
import logging
import numpy as np
from scipy.sparse import csc_matrix
from scipy.sparse import identity
from scipy.sparse.linalg import inv
warnings.filterwa... | StarcoderdataPython |
6489098 | <filename>account/urls.py
from django.urls import path
from rest_framework.authtoken import views as special_views
from account import views
urlpatterns = [
path('login', special_views.obtain_auth_token),
path('register',views.register_view,name="register")
] | StarcoderdataPython |
48308 | <filename>books/booksdatasourcetests.py
'''
booksdatasourcetest.py
<NAME>, 24 September 2021
<NAME>, <NAME>, 11 October 2021
'''
import booksdatasource
import unittest
class BooksDataSourceTester(unittest.TestCase):
def setUp(self):
self.data_source = booksdatasource.BooksDataSource('books_medi... | StarcoderdataPython |
9783256 | <filename>p2p/graph_manager.py
import networkx as nx
import numpy as np
class DummyNode:
def __init__(self, node_id):
self.id = node_id
def sample_neighbors(client_num, num_clients, self_ind):
c_list = list(range(client_num))
c_list.remove(self_ind)
random_indices = np.random.choice(len(c_li... | StarcoderdataPython |
1796619 | from talon import Context, actions, ui, Module, app, clip
ctx = Context()
mod = Module()
mod.apps.gwent = "app.name: Gwent.exe"
ctx.matches = r"""
app: gwent
"""
| StarcoderdataPython |
6638979 | # Generated by Django 2.0 on 2021-04-06 08:18
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('api', '0037_auto_20210203_2216'),
]
operations = [
migrations.AddField(
model_name='objecttype',
... | StarcoderdataPython |
4933809 | <filename>07/solve_2.py
from address import is_compatible, load_addresses
def main():
"""Count the number of addresses compatible with
the second protocol, i.e., matching 'aba[bab]'.
"""
addresses = load_addresses()
print(sum([is_compatible(address, protocol=2) for address in addresses]))
if __n... | StarcoderdataPython |
154207 | from django.urls import path, include
from rest_framework import routers
from . import views
router = routers.SimpleRouter()
router.register('signup',views.UserAccountsViewSet)
urlpatterns = [
path('',include(router.urls)),
path('login/',views.UserLoginApiView.as_view()),
] | StarcoderdataPython |
9648121 | <gh_stars>0
import os
import json
import requests
def getAppDetails(envs):
appDetails = getCuratedAppDetails(envs)
retDict = {}
names = []
counts = []
appCpus = []
appMem = []
totalTasks = 0
for item in ['tasks', 'apps', 'cpus', 'mem']:
dictItem = {}
names = []
v... | StarcoderdataPython |
1745052 | # -*- coding:utf-8 -*-
# Copyright xmuspeech (Author: JFZhou 2020-05-31)
import numpy as np
import os
import sys
sys.path.insert(0, 'subtools/pytorch')
import libs.support.kaldi_io as kaldi_io
from plda_base import PLDA
class CORAL(object):
def __init__(self,
mean_diff_scale=... | StarcoderdataPython |
1780205 | <reponame>3xistentialcrisis/Blog
import unittest
from app.models import Comment, Blog, User
from app import db
class CommentModelTest(unittest.TestCase):
def setUp(self):
self.new_comment = Comment(id=1, comment='Test comment', user=self.user_karanja, blog_id=self.new_blog)
def tearDown(self):
... | StarcoderdataPython |
5059632 | <reponame>mlaugharn/EB_GFN<gh_stars>0
import numpy as np
import torch
import torch.nn as nn
import torchvision
import os, sys
import copy
import time
import random
import ipdb
from tqdm import tqdm
import argparse
import network
sys.path.insert(0, "..")
from gflownet import get_GFlowNet
import utils_data
def makedir... | StarcoderdataPython |
6449297 | import hashlib
import binascii
import sys,os
import time
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.type.ttypes as Types
from evernote.api.client import EvernoteClient
dev_token = "S=s345:U=3<PASSWORD>d5:E=14b41f1d370:C=143ea40a774:P=1cd:A=en-devtoken:V=2:H=db1266a393bb7007ee80e... | StarcoderdataPython |
8187828 | <gh_stars>1-10
from midiutil.MidiFile import MIDIFile
import music_models, argparse, random, note_timing, copy, json, subprocess
#If this value is supplied, the Key class will write down all notes it generates in the file specified.
dir_write_note = ''
def set_dir_write_note(new_dir):
global dir_write_note
d... | StarcoderdataPython |
1727336 | <filename>scripts/scrape_oup.py
# scrapes Oxford university press and returns a list of feeds
# get the main page
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("https://academic.oup.com/journals/pages/journals_a_to_z").read().decode('utf-8')
# get all links from this page
soup = Bea... | StarcoderdataPython |
6459233 | <reponame>junlulocky/BGMM
"""
Author: <NAME>
Contact: <EMAIL>
Date: 2014
"""
import math
import numpy as np
import numpy.testing as npt
from bayes_gmm.gaussian_components_fixedvar import (
GaussianComponentsFixedVar, FixedVarPrior, log_norm_pdf, log_post_pred_unvectorized
)
def test_log_prod_norm():
np... | StarcoderdataPython |
1902435 | # -*- coding: utf-8 -*-
from model.contact import Contact
test_data = [
Contact(firstname='Степан ', middlename='Иванович ',
lastname='Петров ', nickname='Иваныч ',
title='title', company='ОАО ОмПО Радиозавод им. А.С.Попова(РЕЛЕРО) ',
address='г. Омск ул.Ленина д.1 кв. 99', home... | StarcoderdataPython |
11212948 | <reponame>amitkumarj441/QNET<gh_stars>10-100
from functools import partial
import pytest
from sympy import symbols, sqrt, exp, I, Rational, IndexedBase
from qnet import (
CircuitSymbol, CIdentity, CircuitZero, CPermutation, SeriesProduct,
Feedback, SeriesInverse, circuit_identity as cid, Beamsplitter,
Op... | StarcoderdataPython |
3551387 | <reponame>gaarangoa/genomic-scripts<filename>GeneTools/fasta_subset.py
import sys
import click
from Bio import SeqIO
import logging
import gzip
import json
@click.command()
@click.option('--fasta', required=True, help='fasta input file')
@click.option('--entries', required=True, help='tabular file with entries')
def ... | StarcoderdataPython |
1629915 | <reponame>pkfec/regulations-parser
import logging
import click
from regparser.tree.depth import optional_rules
from regparser.tree.depth.derive import derive_depths
logger = logging.getLogger(__name__)
@click.command()
@click.argument('markers', type=click.STRING, required=True)
def outline_depths(markers):
""... | StarcoderdataPython |
1657416 | <reponame>HippoInWindow20/YPHS-HW
import sqlite3
from string import Template
from datetime import datetime
from ftplib import FTP
import requests
import os
usr = os.environ['ftpusr']
psw = os.environ['ftppsw']
def get_current_time():
site=requests.get("https://worldtimeapi.org/api/timezone/Asia/Taipei")
data... | StarcoderdataPython |
4937097 | from __future__ import absolute_import
from __future__ import print_function
import os
__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().splitlines()[0]
| StarcoderdataPython |
3479533 | #!/usr/bin/env python2.7
import os
import sys
from collections import defaultdict
from hashlib import sha1
from optparse import OptionParser
class TreeMatcher(object):
"""Locate and report identical files from two directory trees.
A tree can be a sub-tree of the other.
"""
def __init__(self, ext... | StarcoderdataPython |
3375497 | <reponame>Ben435/BensLoadTestTool
from bad_requests.request import Request
STANDARD_HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0",
"Accept-Language": "en,en-US",
"Accept": "text/html,application/xhtml+xml",
"Accept-Encoding": 'deflate'
}
DEF... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.