id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1615454 | <reponame>dydcfg/prediction-flow
"""
FM layer.
"""
# Authors: <NAME>
# License: MIT
import torch
import torch.nn as nn
class FM(nn.Module):
"""FM layer.
"""
def __init__(self, reduce_sum=True):
super(FM, self).__init__()
self.reduce_sum = reduce_sum
def forward(self, x):
su... | StarcoderdataPython |
1631242 | <gh_stars>0
import os
"""
Contains simple methods and constants for accessing data and files throughout the hp tool.
"""
# can be changed to set where different trello notifications are posted
_TRELLO = {'app_key':'dcb97514b94a98223e16af6e18f9f99e',
'hp_list':'58f4e07b1d52493b1910598f',
'prnu_li... | StarcoderdataPython |
25244 | <filename>lab/migrations/0003_auto_20191202_1534.py
# Generated by Django 2.2.8 on 2019-12-02 15:34
from django.db import migrations, models
import django.db.models.deletion
from lab.models import OperatingSystem
def initial_os_data(app, schema_editor):
data = [
{"os": "ios", "os_type": "cisco_ios", "ter... | StarcoderdataPython |
3349423 |
''' URLS worker: Tries to extract URL from strings output '''
import re
import pprint
class URLS(object):
''' This worker looks for url patterns in strings output '''
dependencies = ['strings']
def __init__(self):
''' Initialize the URL worker '''
self.url_match = re.compile(r'http[s]?://... | StarcoderdataPython |
36714 | <reponame>vyacheslav-bezborodov/skt
import logging
import csv
from urllib2 import urlopen, quote
from datetime import datetime
from stockviewer.utils import make_timedelta, make_fields
class websource():
def __init__(self, config):
logging.debug('Web source init: config {}'.format(config))
self.__config = confi... | StarcoderdataPython |
3328201 | # Advent Of Code 2018, day 16, part 2
# http://adventofcode.com/2018/day/16
# solution by ByteCommander, 2018-12-16
import re
SAMPLE_PATTERN = re.compile(
r"^Before: +\[(\d+), (\d+), (\d+), (\d+)\]\n"
r"^(\d+) (\d+) (\d+) (\d+)\n"
r"^After: +\[(\d+), (\d+), (\d+), (\d+)\]\n",
re.MULTILINE
)
PROGRAM_PA... | StarcoderdataPython |
1663648 | <gh_stars>0
import lsst.daf.persistence as dafPersist
import pfs.instmodel.makePfsConfig as makeConfig
import numpy as np
from pfs.drp.stella.datamodel.pfsConfig import PfsConfig as StellaPfsConfig
design_id = 123
# design_id = 0xfedcba9876543210
# This demonstrates that using a negative hash
# (such as can be gener... | StarcoderdataPython |
89955 | # coding: utf-8
# author: xuxc
import os
import platform
import random
import sys
from PyQt5.QtCore import (
Qt,
QSettings,
QByteArray,
PYQT_VERSION_STR
)
from PyQt5.QtGui import (
QIcon,
QKeySequence,
QCloseEvent
)
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QVBoxL... | StarcoderdataPython |
3307884 | import pandas as pd
import numpy as np
from datetime import datetime
def read_data(file_name, skiprows = 0, index_col = False):
df = pd.read_csv(file_name, skiprows = skiprows,error_bad_lines=False,index_col = index_col)
df = df[['bbr_x','bbr_y','fbr_x','fbr_y','fbl_x','fbl_y','bbl_x','bbl_y',
'Fr... | StarcoderdataPython |
1670092 | #%%
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np # numpy for arrays
from tqdm import tqdm
import SpecCAF.Solver as Solver
import SpecCAF.spherical as spherical
from matplotlib import pyplot as plt
from scipy.interpolate import interp1d,interp2d
from scipy.signal import find_peaks
from scipy.ndimag... | StarcoderdataPython |
3351894 | """The tests for the Canary component."""
import unittest
from homeassistant import setup
import homeassistant.components.canary as canary
from tests.async_mock import MagicMock, PropertyMock, patch
from tests.common import get_test_home_assistant
def mock_device(device_id, name, is_online=True, device_type_name=No... | StarcoderdataPython |
3209118 | import discord
from discord.ext import commands
from discord.commands import CommandPermission, SlashCommandGroup
import json
with open ('././config/guilds.json', 'r') as f:
data = json.load(f)
guilds = data['guilds']
with open ('././config/guilds.json', 'r') as f:
data = json.load(f)
modeRole = data['modRole']
... | StarcoderdataPython |
3339996 | <gh_stars>0
import json
import time
import requests
class MerakiManager():
"""
Meraki Manager
Attribute:
_notify_mgr_: notification manager
_url_: Meraki URL
_api_key_: Meraki API key
"""
def __init__(self, notify_mgr, url, apikey):
self._notify_mgr_ = notify_mgr
self... | StarcoderdataPython |
1703247 | <reponame>PercivalN/aiida-core<gh_stars>1-10
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | StarcoderdataPython |
1775112 | <filename>elib_wx/weather.py
# coding=utf-8
"""
Main interface module for elib_wx
"""
import elib_miz
from elib_wx import (
LOGGER, airports_db, exc, weather_dcs_generate, weather_from_icao, weather_from_metar_data,
weather_from_metar_string, weather_from_miz, weather_to_mission, weather_to_miz, weather_trans... | StarcoderdataPython |
143153 | <gh_stars>1-10
""" Here, the format of the potential_file is defined """
from .sections import *
def fce():
from ...common.misc import OrderedDict
from ...common.grammar_types import \
Keyword, DefKeyword, Table, Array, Sequence, \
integer, Date, boolean, line_string
from ..potential_definition... | StarcoderdataPython |
1703049 | <reponame>vandreykiv/openpilot
from selfdrive.car.tesla.speed_utils.fleet_speed import FleetSpeed
from selfdrive.car.tesla.values import CruiseButtons, CruiseState
from selfdrive.config import Conversions as CV
import cereal.messaging as messaging
import sys
import time
from cereal import car
# CS.v_ego -> CS.out.vEgo... | StarcoderdataPython |
3201111 | # Generated by Django 3.1.1 on 2020-10-19 07:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='innertransaction',
old_name='accout_to',
... | StarcoderdataPython |
156763 |
from colorama import init,Back
import random
import string
def random_char(y):
return ''.join(random.choice(string.ascii_lowercase) for x in range(y))
def checkinput(wrd,guess):
strout=''
for idx,i in enumerate(guess):
if wrd[idx]==i:
strout=strout + Back.GREEN + ' ' + i + ' '+ Back.B... | StarcoderdataPython |
1758166 | <filename>launcher/setup.py
#!/usr/bin/env python
from distutils.core import setup
install_requires = ["exonum-launcher==0.2.0"]
python_requires = ">=3.6"
setup(
name="exonum_btc_anchoring_plugin",
version="0.1",
description="Exonum BTC anchoring plugin",
url="https://github.com/exonum/exonum-btc-anc... | StarcoderdataPython |
3332197 | from typing import Any, IO
import sys
class Base:
'''An output stream that supports tokens.'''
def write(self, thing: Any) -> None:
'''Show anything that can be converted to a string.'''
self.override_write(str(thing))
def override_write(self, string: str) -> None:
'''Print a strin... | StarcoderdataPython |
1797353 | <reponame>rajat4665/Validator<filename>v1/tasks/sync.py<gh_stars>1-10
import logging
from json import JSONDecodeError
from celery import shared_task
from django.core.cache import cache
from nacl.exceptions import BadSignatureError
from thenewboston.blocks.signatures import verify_signature
from thenewboston.utils.form... | StarcoderdataPython |
3243122 | import numpy as np
class NeuralNetwork(object):
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
self.output_nodes = output_nodes
self.weights_input_to_hidden = np.random.normal(0.0, self.inpu... | StarcoderdataPython |
3337091 | <filename>dialogue-engine/test/programytest/utils/email/test_sender.py
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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 wit... | StarcoderdataPython |
1729356 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import *
from j5basic import Units
from j5test import Utils
i... | StarcoderdataPython |
1636341 | <reponame>jhhalls/helper_functions
'''
@author : jhhalls
'''
def plot_stratified_cross_validation():
fig, both_axes = plt.subplots(2, 1, figsize=(12, 5))
# plt.title("cross_validation_not_stratified")
axes = both_axes[0]
axes.set_title("Standard cross-validation with sorted class labels")
axes.set... | StarcoderdataPython |
90305 | <filename>goverge/test/test_reports.py
"""
Copyright 2016 Workiva, 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... | StarcoderdataPython |
142308 | <gh_stars>1-10
from Pluto.Libraries.Libraries.GLM import *
| StarcoderdataPython |
1790929 | import argparse
import unittest
from unittest import mock
import skelebot as sb
class TestExecutor(unittest.TestCase):
@mock.patch('skelebot.systems.execution.executor.print')
@mock.patch('skelebot.systems.parsing.skeleParser')
@mock.patch('skelebot.systems.execution.executor.VERSION', '6.6.6')
def t... | StarcoderdataPython |
4810056 | <gh_stars>1-10
from scipy.sparse import lil_matrix, csr_matrix, dia_matrix
import numpy as np
import math
import logging
def affinity_matrix(M: csr_matrix, threshold: float) -> csr_matrix:
""" Computes the affinity matrix for matrix M. Each row is compared to each
other row and a gaussian is used to calculate... | StarcoderdataPython |
4801180 | #!/usr/bin/env python3
# pylint: disable=W0703
from collections import defaultdict
import asyncio
import logging
from typing import Set, Dict, Any, List
from google.cloud import storage
from sample_metadata.apis import WebApi, SampleApi, SequenceApi, ProjectApi
# Global vars
logger = logging.getLogger(__file__)
log... | StarcoderdataPython |
1728240 | <reponame>angelm1974/DjangoSzkola
from django.urls import path
from .import views
urlpatterns = [
path('',views.index, name='index'),
path('<int:pytanie_id>/',views.detail, name='detail'),
path('<int:pytanie_id>/wynik/',views.wynik, name='wynik'),
path('<int:pytanie_id>/glosuj/',views.glo... | StarcoderdataPython |
4818120 | from django.db import models
from django.utils import timezone
from ckeditor.fields import RichTextField
class Server(models.Model):
server_name = models.CharField(max_length=16)
server_ip = models.CharField(max_length=32)
rcon_password = models.CharField(max_length=100)
rcon_port = models.IntegerFiel... | StarcoderdataPython |
128165 | <gh_stars>1-10
#!/usr/bin/env python
import accident_prediction_montreal
from accidents_montreal import get_accident_df
from weather import get_useful_stations_id_df
from utils import init_spark
from preprocess import preprocess_accidents
spark = init_spark()
accident_df = preprocess_accidents(get_accident_df(spark))... | StarcoderdataPython |
3397837 | #!/usr/bin/python
# encoding: utf-8
import sys
import logging
from traktapi import TraktAPI
from workflow import Workflow
def main(wf):
logging.basicConfig(level=logging.DEBUG)
action = wf.args[0]
if len(wf.args) > 1:
params = wf.args[1:]
traktapi = TraktAPI(wf)
"""
Actions WITHOUT... | StarcoderdataPython |
196218 | <gh_stars>0
import random
import copy
from Genetic.Strategy import Strategy
from Genetic.Report import Report
from Operations import ParentSelection
from Operations import Mutation
from Operations import Recombination
import matplotlib.pyplot as ploter
# Runs each strategy a specific number of times
def RunS... | StarcoderdataPython |
3317098 | import math as Jean
moi = 7
Jean.atan(moi) #HumourDeMerde ... x)
| StarcoderdataPython |
1691259 | <filename>tests/unit/management/test_check_availability.py
import unittest
import numpy as np
import pandas as pd
from macrosynergy.management.check_availability import check_startyears, check_enddates
from tests.simulate import make_qdf
cids = ['AUD', 'CAD', 'GBP']
xcats = ['CRY', 'XR']
df_cids = pd.DataFrame(
in... | StarcoderdataPython |
151748 | <gh_stars>0
import os
import src.main
# Check if the bin and dst directories are present, and if not, generate them.
if os.path.isdir(os.path.join(os.path.dirname(__file__), "bin")) == False:
print("'bin' directory not found. Generating...")
os.makedirs(os.path.join(os.path.dirname(__file__), "bin"))
if os.pat... | StarcoderdataPython |
73462 | from ...accounts import Account, account_factory
import tempfile
import os
import pickle
from os import listdir
from os.path import isfile, join
class LocalFileSystemAccountAdapter():
def __init__(self, root=None):
if root is None: root = tempfile.gettempdir()
if not os.path.exists(root+"/accounts... | StarcoderdataPython |
1617520 | def func():
"""
Returns:
int:
return value description
""" | StarcoderdataPython |
11023 | <reponame>peterson-dev/code-snippet-app
# Generated by Django 2.2.1 on 2019-05-28 22:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20190523_1740'),
]
operations = [
migrations.RenameField(
model_name='snippet'... | StarcoderdataPython |
23412 | <filename>frontend/main.py
import json
import operator
import os
import webbrowser
from timeit import default_timer as timer
from kivy.app import App
from kivy.config import Config
from kivy.properties import ObjectProperty
from kivy.uix.stacklayout import StackLayout
from nltk.stem.wordnet import WordNetLemmatizer
C... | StarcoderdataPython |
3270732 | <filename>server/performance_test.py
import unittest
import performance
class TestPerformance(unittest.TestCase):
def setUp(self):
self.settings = {
'departure_elevation': 7,
'arrival_elevation': 1000,
'cruise_altitude': 9500,
'power_pct': 65,
'fuel': 48,
'variance... | StarcoderdataPython |
135613 | <reponame>NOAA-PMEL/envDataSystem<filename>daq_server/config/dummy_cfg.py<gh_stars>1-10
dummy1_iface_cfg = {
'INTERFACE': {
'MODULE': 'daq.interface.interface',
'CLASS': 'DummyInterface',
},
'IFCONFIG': {
'LABEL': 'Dummy1',
'ADDRESS': 'DummyAddress',
'SerialNumber': '... | StarcoderdataPython |
85966 | # COMPARANDO NÚMEROS
num1 = int(input("Primeiro valor: "))
num2 = int(input("Segundo valor: "))
print("-=" * 10)
if num1 > num2:
print("Primeiro valor MAIOR.")
elif num2 > num1:
print("Segundo valor MAIOR.")
else:
print("Os dois valores são iguais.") | StarcoderdataPython |
92177 | from django.conf.urls import url
from django.urls import path
from . import views
app_name = "safe"
timestamp_regex = '\\d{4}[-]?\\d{1,2}[-]?\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}'
urlpatterns = [
url(r'^about/$', views.AboutView.as_view(), name='about'),
path('safes/<str:address>/', views.SafeInfoView.as_view... | StarcoderdataPython |
3338351 | <reponame>fjarri/pykka
import asyncio
import sys
import traceback
import pytest
from pykka import Future, Timeout, get_all
from tests import has_gevent
def run_async(coroutine):
loop = asyncio.get_event_loop()
f = asyncio.ensure_future(coroutine, loop=loop)
return loop.run_until_complete(f)
def test_... | StarcoderdataPython |
4813791 | import enum
import json
from datetime import datetime
from operator import attrgetter
from typing import Any, Dict, List, Optional, Union
from fastapi import APIRouter, Depends, Path, Query
from fastapi.encoders import jsonable_encoder
from fastapi.logger import logger
from requests.exceptions import ConnectionError, ... | StarcoderdataPython |
1631149 | #! /usr/bin/env python3
import sys
from mp4utils import DerivePlayReadyKey, Base64Decode
###########################
if __name__ == '__main__':
if len(sys.argv) != 3 and len(sys.argv) != 4:
sys.stderr.write('ERROR: invalid arguments\n')
sys.stderr.write('Usage: pr-derive-key.py [--no-swap] <seed-b... | StarcoderdataPython |
3320049 |
from django.test import TestCase
from guardian.utils import get_anonymous_user
from rnapuzzles.models import CustomUser, Group
class AnonymousPermissions(TestCase):
def setUp(self):
self.group = Group.objects.create(group_name="Test")
self.group2 = Group.objects.create(group_name="Test2")
... | StarcoderdataPython |
25336 | <gh_stars>0
from django.test import LiveServerTestCase
from selenium import webdriver
def populate_db():
from lorawan.tests import populate_db_with_devices
populate_db_with_devices(["Devices 1", "Devices 2"])
class NewVisitorTest(LiveServerTestCase):
def setUp(self):
import os
is_trav... | StarcoderdataPython |
3391125 | <filename>instance/config.py
import os
class Config(object):
"""Configuration class"""
DEBUG = True
CSRF_ENABLED = True
SECRET = "<PASSWORD>"
| StarcoderdataPython |
14664 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 12:41:09 2017
@author: lracuna
"""
#!/usr/bin/env python
"""
This program uses a simple implementation of the ADMM algorithm to solve
the circle packing problem.
We solve
minimize 1
subject to |x_i - x_j| > 2R,
R < x_i, ... | StarcoderdataPython |
69677 | <filename>array-rotation-by-any-element.py
from array import *
arr = array("i",[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])
n = int(input("enter the element from where you want to rotate the array : "))
i = 0
while(i < n):
temp = arr[0]
j = 0
while(j < len(arr)-1):
arr[j] = arr[j+1]
arr[j+1] ... | StarcoderdataPython |
1694473 | <reponame>xdumaine/python-euler
#!/usr/bin/python
import mathUtils
import sys
if(len(sys.argv) < 2):
print("Pass in an argument to check")
quit()
num = int(sys.argv[1])
print(mathUtils.largestPrimeFactor(num))
| StarcoderdataPython |
56064 | import csv
from .ParamGenerator import ParamGenerator
class CSVParamGenerator(ParamGenerator):
def __init__(self):
self.source = []
self.count = 0
def set_source(self, source):
try:
with open(source, newline='') as f:
reader = csv.reader(f)
... | StarcoderdataPython |
101253 | #
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... | StarcoderdataPython |
3314392 | """Creating bounding functions"""
from .bf import BoundingFunction
| StarcoderdataPython |
1702471 | from typing import List
class Solution:
def nextGreatestLetter(self, letters: List[str], target: str) -> str:
start=0
end=len(letters)-1
if target<letters[0]:
if ord(letters[0])-ord(target)<ord('z')-ord(letters[end])+ord(target)-ord('a'):
return letters[0]
... | StarcoderdataPython |
1789154 | <reponame>burnalting/stroom-content
#!/usr/bin/env python3
#**********************************************************************
# Copyright 2016 Crown Copyright
#
# 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 c... | StarcoderdataPython |
1695067 | <gh_stars>0
'''
1) Create an empty stack s.
2) Initialize current node as root
3) Push the current node to s and set current = current->left until current is None.
4) If current is None and stack is not empty then
a) Pop the top item from stack.
b) Print the popped item, set current = popped_item->right
... | StarcoderdataPython |
3339553 | <gh_stars>0
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python [conda env:bandit_38]
# language: python
# name: con... | StarcoderdataPython |
3260413 | <gh_stars>10-100
import pyclesperanto_prototype as cle
import numpy as np
def test_bounding_box_2d():
test = cle.push(np.asarray([
[0, 0, 0, 0, 0],
[0, 1, 1, 0, 0],
[0, 1, 1, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
]))
bb = cle.bounding_box(test)
print(bb)
... | StarcoderdataPython |
3248456 | """ Game fix for Banished
"""
# pylint: disable=C0103
from protonfixes import util
def main():
""" Install xact and override
"""
print('Applying fixes for Banished')
# If not already installed, install xact
if not util.checkinstalled('xact'):
util.protontricks('xact')
# Set xaudio2_... | StarcoderdataPython |
1756139 | import torch
import numpy as np
import torch.utils.data
from lib.add_window import Add_Window_Horizon
from lib.load_dataset import load_st_dataset
from lib.normalization import NScaler, MinMax01Scaler, MinMax11Scaler, StandardScaler, ColumnMinMaxScaler
def normalize_dataset(data, normalizer, column_wise=False):
if... | StarcoderdataPython |
3248330 | from datetime import datetime
from decimal import Decimal
from casexml.apps.stock.models import StockReport, StockTransaction
from corehq.apps.commtrack.models import SupplyPointCase
from corehq.apps.locations.models import LocationType, Location
from corehq.apps.products.models import SQLProduct
from corehq.apps.sms.a... | StarcoderdataPython |
1754189 | # Importing Django packages:
from django.urls import resolve
from django.apps import apps
from django.conf import settings
# Method that extracts a list of all API apps for the project:
def get_user_api_app_permissions(permission_lst):
"""A method that parses a permission set to extract a subset
of API apps.
... | StarcoderdataPython |
192745 | from __future__ import unicode_literals
__title__ = 'Mayan EDMS'
__version__ = '1.1.1'
__build__ = 0x010101
__author__ = '<NAME>'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2011-2015 <NAME>'
| StarcoderdataPython |
4836288 | from setuptools import setup, find_packages
# PLEASE DO NOT EDIT THIS, MANAGED FOR CI PURPOSES
__QUALIFIER__ = ""
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="{{ cookiecutter.project_name }}",
version="{{ cookiecutter.project_version }}" + __QUALIFIER__,
description="{... | StarcoderdataPython |
1795161 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import CubicSpline
import json
"""
Please download the original bus signals data of each city from a2d2: https://www.a2d2.audi/a2d2/en/download.html
the available locations are "Gaimersheim", "Munich" and "Ingolstadt"
and ... | StarcoderdataPython |
3390593 | <gh_stars>0
from collections import defaultdict, deque
# Use this for effective implementation of L-BFGS
from matplotlib.pyplot import hist
from scipy.linalg import cho_factor, cho_solve
import numpy as np
import time
from oracles import BaseSmoothOracle
from utils import get_line_search_tool
def is_not_neg_def(x):... | StarcoderdataPython |
1672670 | <filename>scripts/io_place.py
#!/usr/bin/env python3
# Copyright 2020 Efabless Corporation
#
# 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 |
3235271 | try:
import datetime
import gps
except ImportError:
from mocks import MockGPS
gps = MockGPS()
import logging
import time
from time import gmtime
from sensors import gpsReport
class gyneo6mv2(object):
def read(self):
report = self.session.next()
return (report.lat, report.lon, gmtim... | StarcoderdataPython |
75074 | #
# Copyright (C) 2021 Vaticle
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0... | StarcoderdataPython |
10591 | # -*- coding: utf-8 -*- #
# Copyright 2016 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 requir... | StarcoderdataPython |
149972 | <reponame>ANRGUSC/I3-core
from django.contrib import admin
# Register your models here.
from .models import Transaction
from .models import ItemCount, RestrictedRequest
class TransactionAdmin(admin.ModelAdmin):
# inlines = [ThumbnailInline]
list_display = ["__unicode__", "product", "buyer", "seller", "quant... | StarcoderdataPython |
1719727 | <reponame>yegarti/arcade<filename>arcade/experimental/bloom_filter.py
"""
See: https://www.shadertoy.com/view/lsBfRc
"""
from arcade.experimental import Shadertoy
class BloomFilter:
"""
CRT Filter
:param int width:
:param int height:
"""
def __init__(
self,
width: int, height... | StarcoderdataPython |
3344381 | import logging
import time
import threading
import os
from telegram import ChatAction, error
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler
from command.Command import Command
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(messa... | StarcoderdataPython |
1686796 | # Copyright (c) 2021, <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the followin... | StarcoderdataPython |
1759487 | <gh_stars>1-10
import pytest
from flyteidl.core import catalog_pb2, errors_pb2
from flytekit.core.context_manager import FlyteContextManager
from flytekit.core.task import task
from flytekit.core.type_engine import TypeEngine
from flytekit.core.workflow import workflow
from flytekit.models.types import LiteralType, Si... | StarcoderdataPython |
3292222 | <filename>storage/storage.py
#!/usr/bin python3
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
import logging
from os import getenv
from typing import Union, NoReturn
from gzip import compress
# 3rd party:
from azure.storage.blob import (
BlobClient,... | StarcoderdataPython |
1600256 | import lib.math.linalg
from lib.math.linalg.vector import *
from lib.math.functions.small import *
| StarcoderdataPython |
1658554 | <reponame>arXiv/arxiv-references
"""
Procedure for merging extracted reference metadata.
The :mod:`references.process.extract` module provides an entry-point to several
reference extraction mechanisms, each of which provides variable levels of
completeness and quality.
.. automodule:: merge
:members:
"""
from typ... | StarcoderdataPython |
1652774 | # !/usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
import tf_utils
def placeholder_inputs(batch_size, img_w, img_h):
input_img_pl = tf.placeholder(tf.float32, shape=(batch_size, img_w, img_h))
label_seg_pl = tf.placeholder(tf.int32, shape=(batch_size, img_w, img_h))
label_cls_pl = tf.plac... | StarcoderdataPython |
3252386 | #!/usr/bin/env python
import sys
import csv
import json
movieFile = "./movielens/movies.csv"
movieList = {}
with open(movieFile, mode = 'r') as infile:
reader = csv.reader(infile)
for row in reader:
movieList[row[0]] = {}
movieList[row[0]]["title"] = row[1]
movieList[row[0]]["genre"] ... | StarcoderdataPython |
4839564 | # -*- coding: utf-8 -*-
import numpy as np
import scipy.ndimage
import scipy.special
import sklearn.neighbors
def mutual_information(x, y, method="varoquaux", bins=256, sigma=1, normalized=True):
"""Mutual Information (MI)
Computes the (normalized) mutual information (MI) between two vectors from a joint his... | StarcoderdataPython |
3210899 | from django.apps import AppConfig
class RelativeurlConfig(AppConfig):
name = 'relativeurl'
| StarcoderdataPython |
3323802 | <gh_stars>1-10
# -*- coding: utf-8 -*-
'''
Run me to update the release notes in the documentation.
I will pull the content from ../CHANGE_LOG and insert that into
./source/doc/releases.rst
'''
from __future__ import print_function, division, absolute_import
title_template = '''
.. DO NOT EDIT THIS FILE.
This fi... | StarcoderdataPython |
3224582 | <reponame>howardhsu/ASC_failure
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team and authors from University of Illinois at Chicago.
# Copyright (c) 2018, <NAME>. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file excep... | StarcoderdataPython |
3212080 | from django.apps import AppConfig
class ProlinkConfig(AppConfig):
name = 'prolink'
| StarcoderdataPython |
3266269 | import time
import random
from tqdm import tqdm
import numpy as np
def efficient_greedy(
measure,
dataset_size,
subset_size,
start_indices,
intermediate_target=None,
clustering_combinations=None,
celf_ratio=0,
verbose=True
):
candidates = list(set(range(dataset_size)) - set(start... | StarcoderdataPython |
3270550 | #! /bin/python
# $Id
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 <NAME>
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
#
# This Source Code may also be made available und... | StarcoderdataPython |
167719 | #!/usr/bin/env python
import wx
import os
import sys
try:
dirName = os.path.dirname(os.path.abspath(__file__))
except:
dirName = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(os.path.split(dirName)[0])
try:
from agw import gradientbutton as GB
bitmapDir = "bitmaps/"
except ImportErr... | StarcoderdataPython |
59419 | <gh_stars>1-10
from doxyfile import *
from mainpage import *
| StarcoderdataPython |
1652342 | try:
import lib.pyUnitConvert as uc
except:
import pyUnitConvert as uc
from Approx import *
def test_registry():
ureg = uc.UnitRegistry()
ureg.addUnit("m = [L]")
ureg.addUnit("g = [M]")
ureg.addUnit("s = [T]")
ureg.addUnit("1 in = 2.54 cm")
ureg.addUnit("1 ft = 12 in")
ureg.addUnit("1 mile = 5280... | StarcoderdataPython |
156503 | <reponame>gzcf/polyaxon
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils.functional import cached_property
from db.models.abstract_jobs import AbstractJobStatus, JobMixin
from db.models.plugins import PluginJobBase
from db.models.unique_names import NOTEBOOK_UNIQUE_NA... | StarcoderdataPython |
131072 | import pytest
from pytest_django.asserts import assertContains, assertNotContains
@pytest.mark.django_db
def test_search_view_summary(client):
# Search based on summary should return two posts
response = client.get('/search/', {'query': 'normal'})
assert response.status_code == 200
assertContains(res... | StarcoderdataPython |
3264946 | <filename>ssllabs/data/hpkp_policy.py
from dataclasses import dataclass
from typing import Dict, List, Optional
@dataclass
class HpkpPolicyData:
"""Dataclass for HPKP Policy objects.
See also: https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs-v3.md#hpkppolicy
"""
header: Optional[... | StarcoderdataPython |
3338034 | # -*- coding: utf-8 -*-
"""
First singular person pronoun analysis
.. _Google Python Style Guide
https://github.com/google/styleguide/blob/gh-pages/pyguide.md
"""
__copyright__ = 'Copyright 2019, University of Messina'
__author__ = '<NAME> <<EMAIL>>'
__credits__ = ''
__description__ = 'First singular person pron... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.