id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
11382027 | <reponame>sweettuse/lifxlan3<filename>lifxlan3/routines/tile/tile_utils.py
from collections import defaultdict, Counter
from contextlib import suppress
from functools import lru_cache
from io import BytesIO
from itertools import islice, cycle, groupby, product
from types import SimpleNamespace
from typing import List, ... | StarcoderdataPython |
6642906 | '''Faça um programa que peça 10 números para o usuário e guarde os números em uma lista.
Imprima os itens da lista preenchida de trás para frente.'''
cont = 0
lista_Numeros = []
qtde_Numeros = 10
numeros = float(input(f"Digite {qtde_Numeros} números: "))
while cont < qtde_Numeros:
lista_Numeros.append(nu... | StarcoderdataPython |
371666 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 17:49:42 2020
@author: sixingliu, yaruchen
"""
from sensorpowa.core.frame import SensorFrame
from sensorpowa.core.series import SensorSeries
import numpy as np
class _SensorACM(SensorFrame):
"""
The biosensor module also contains a three dimensional acceler... | StarcoderdataPython |
3227001 | # plot example sample to check
import pandas as pd
import matplotlib.pyplot as plt
# parameters
# ---
# which subset
subset = 'survey_only'
rho = 1700
# where are the samples and where to put results
dir_results = '../../results/neutral_data_fitm/'
# where to find the island area and richness data
fname_area = '..... | StarcoderdataPython |
1704114 | <reponame>marwanelshantaly/EIN-SELD<gh_stars>10-100
from pathlib import Path
import numpy as np
import pandas as pd
import methods.utils.SELD_evaluation_metrics_2019 as SELDMetrics2019
from methods.utils.data_utilities import (load_dcase_format,
to_metrics2020_format)
from me... | StarcoderdataPython |
6402396 | <reponame>mudbungie/NetExplorer<filename>env/lib/python3.4/site-packages/bulbs/base/client.py
# -*- coding: utf-8 -*-
#
# Copyright 2011 <NAME> (http://jamesthornton.com)
# BSD License (see LICENSE for details)
#
"""
Bulbs supports pluggable backends. These are the abstract base classes that
provides the server-clien... | StarcoderdataPython |
3542564 | from distutils.version import StrictVersion
import django
from django.core.validators import RegexValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cmsplugin_text_ng.compat import AbstractText
from cmsplugin_text_ng.type_registry import register_type, get_type_list
c... | StarcoderdataPython |
8023433 | <reponame>Koalapvh13/python_exercises
#Faça um Programa que peça as 4 notas bimestrais e mostre a média
n1 = float(input('1ª nota: '))
n2 = float(input('2ª nota: '))
n3 = float(input('3ª nota: '))
n4 = float(input('4ª nota: '))
m = (n1+n2+n3+n4)/4
print('A sua média é {}.'.format(m))
| StarcoderdataPython |
3334164 | <filename>datapack/data/scripts/quests/338_AlligatorHunter/__init__.py<gh_stars>0
# Made by mtrix
import sys
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
qn = "338_Alligat... | StarcoderdataPython |
3553043 | <reponame>cj-wong/Caltab
# Copyright 2019-2021 cj-wong
#
# 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 |
1758124 | <gh_stars>0
from flask import request, flash
from app.controllers.admin import admin_bp
from app.models.course import Course
from app.models.courseInstructor import CourseInstructor
from app.models.courseParticipant import CourseParticipant
from peewee import *
@admin_bp.route('/withdrawCourse/<courseID>', methods = [... | StarcoderdataPython |
5132874 | <reponame>Kris-Kindle/FARS-DBF-Reader<filename>Read_DBF.py
from dbfread import DBF
import zipfile
import sys
import csv
## This will unzip the downloaded folder from FARS
#zip_ref = zipfile.ZipFile('/Users/Kris/Documents/FARS_Reader/FARS2015NationalDBF.zip', 'r')
#zip_ref.extractall('/Users/Kris/Documents/FARS_Reader/... | StarcoderdataPython |
3314159 | <filename>diva/formats.py
#!/bin/env python2
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 <NAME> <<EMAIL>>
#
# 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... | StarcoderdataPython |
4870719 | import posixpath
import os.path
SKIP_FILE = object()
class HeaderHandler(object):
def __init__(self, include_paths):
self.include_paths = list(include_paths)
self.resolved = {}
def _open(self, header_path):
try:
f = open(header_path)
except IOError:
r... | StarcoderdataPython |
6617752 | """
All the custom settings are placed here. The settings are therefore loaded
trough environment variable `FLASK_APP_SETTINGS` that should be just a location
of the file
"""
import os
import ast
import datetime
import binascii
# GENERAL SETTINGS
DEBUG = False
FLASK_ENV = os.getenv('FLASK_ENV', 'production')
SECRET_K... | StarcoderdataPython |
308522 | <reponame>sggrilo/Curso-em-Video-Python
# JOGO DA ADIVINHAÇÃO V2.0 — Melhore o jogo do Desafio 028 em que o computador vai "pensar" em um número entre 0 e 10,
# mas agora o jogador vai tentar até acertar, mostrando no final quantos palpites foram necessários para vencer.
from random import randint
num = randint(0, 10)... | StarcoderdataPython |
1703731 | # -*- coding: utf-8 -*-
import pytest
import pandas as pd
from anacode.agg import aggregation as agg
@pytest.fixture
def frame_sentiments():
header = ['doc_id', 'text_order', 'sentiment_value']
sentiments = pd.DataFrame([
[0, 0, 0.5],
[0, 1, -0.5],
[0, 2, 0.5],
[1, 0, -1.0],
... | StarcoderdataPython |
5138408 | <filename>out/plot.py
import matplotlib.pyplot as plt
import pandas as pd
cn_eval = pd.read_csv('client_num_eval.csv')
cn_data_multiple = 32 * 10 * 10 # 32K * 10 files * 10 repeat times
cn_speed = cn_eval['N'] * cn_data_multiple / cn_eval['total_time'] / 1024 # in MB
cn_eval['speed'] = cn_speed
ds_eval = pd.read_csv(... | StarcoderdataPython |
12827217 | <reponame>NuclearCactus/FOSSALGO
#Python program for KMP Algorithm
def LPSArray(pat, M, lps):
lenn = 0
i = 1
while i < M:
if pat[i]== pat[lenn]:
lenn += 1
lps[i] = lenn
i += 1
else:
if lenn != 0:
lenn = lps[lenn-1]
else:
lps[i] = 0
i += 1
def KMP(pat, txt):
M = len(pat)
N = len(txt)... | StarcoderdataPython |
9705764 | <filename>src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/grammar/MetricAlertConditionLexer.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.... | StarcoderdataPython |
1857386 | <reponame>alexanderkell/reinforcement-learning-investment-FTT-Power<gh_stars>0
import matlab.engine
import argparse
import os
from multiprocessing import Process
from subprocess import Popen
import ray
from ray.rllib.agents.dqn import DQNTrainer
from ray.rllib.agents.ppo import PPOTrainer
from ray.rllib.agents.ddpg im... | StarcoderdataPython |
6669079 | #!/usr/bin/env python3
# coding: utf-8
# @Author: ArthurBernard
# @Email: <EMAIL>
# @Date: 2019-03-23 11:36:05
# @Last modified by: ArthurBernard
# @Last modified time: 2020-02-05 17:41:40
""" Tools to manage date and time. """
# Built-in packages
import time
# External packages
# Local packages
__all__ = ['date_t... | StarcoderdataPython |
9767529 | <reponame>Bayashka1/open-rcv<filename>openrcv/test/test_parsing.py
#
# Copyright (c) 2014 <NAME>. All rights reserved.
#
# 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, i... | StarcoderdataPython |
71409 | <filename>auth0/v2/authentication/link.py
from .base import AuthenticationBase
class Link(AuthenticationBase):
"""Link accounts endpoints.
Args:
domain (str): Your auth0 domain (e.g: username.auth0.com)
"""
def __init__(self, domain):
self.domain = domain
def unlink(self, acces... | StarcoderdataPython |
5119752 | bind = ":8080"
workers = 1
threads = 8
logfile = "-"
loglevel = "DEBUG"
| StarcoderdataPython |
3420650 | <gh_stars>10-100
from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
import numpy as np
dataset=load_iris()
#print(dataset)
X_train,X_test,y_train,y_test=train_test_split(dataset["data"],dataset["target"],random_state=0)
... | StarcoderdataPython |
74561 | """# HTML Widget Functionality
Provides the HTMLWidget and HTMLWidgetGenerator
"""
from ..html_component import HTMLComponent
class HTMLWidget(HTMLComponent): # pylint: disable=too-few-public-methods
"""Your HTML Widgets should inherits this"""
| StarcoderdataPython |
12809040 | # pylint: disable=missing-module-docstring
from typing import Union
from typing import List
from enum import Enum
from aibc import async_make_request
async def snapshot(contract_ids: List[str], since: int = None, fields: list = None) -> dict:
"""Get Market Data for the given conid(s).
The endpoint will retu... | StarcoderdataPython |
8138159 | #!/usr/bin/env python3
# imports go here
import json
import os
import tweepy
from flask import Flask, request
app = Flask(__name__)
#
# Free Coding session for 2014-12-18
# Written by <NAME>
#
consumer_key = os.environ['TWITTER_CONSUMER_KEY']
consumer_secret = os.environ['TWITTER_CONSUMER_SECRET']
access_token = os... | StarcoderdataPython |
11314736 | <filename>ivobject/decorator.py
def invariant(fn):
def invariant_fn(cls, instance):
return fn(cls, instance)
return invariant_fn
def param_invariant(fn):
def param_invariant_fn(cls, instance):
return fn(cls, instance)
return param_invariant_fn
| StarcoderdataPython |
11363758 | '''
A simulation implementing the SIRS model of infectious disease spread in a population and in particular demonstrating
probe plotting.
'''
from pram.data import ProbePersistenceMem, GroupSizeProbe
from pram.entity import Group
from pram.model.epi import SIRSModel
from pram.sim import Simulation
# --... | StarcoderdataPython |
5055071 | from __future__ import annotations
import dataclasses
from typing import Dict, Tuple
import numpy as np
from coffee.client import BulletClient
from coffee.structs import JointInfo, JointType
@dataclasses.dataclass(frozen=True)
class Joints:
"""A convenience class for accessing the joint information of a PyBull... | StarcoderdataPython |
8140610 | products = {"Grape": 5.9, "Guava": 4.9,
"Mango": 4.9, "Cashew": 2.4,
"Banana": 3.0, "Pear": 5.8}
for pro, price in products.items():
print(pro, " = ", price)
cost = 0
while True:
pro = input("Select product (n=nothing): ")
if pro == 'n':
break
qty = int(input("Number of ... | StarcoderdataPython |
11333046 | <gh_stars>0
class Row:
def __init__(self, init_number_of_matches):
self.number_of_matches = init_number_of_matches
def remove_matches(self, number_to_remove):
if self.number_of_matches - number_to_remove >= 0:
self.number_of_matches = self.number_of_matches - number_to_remove
... | StarcoderdataPython |
3522498 | <filename>dictionary/merriam_webster_scraper.py<gh_stars>1-10
"""This module handles scraping dictionary entries and adding them to the db
This module handles visiting a website to look up a word's definition and then
navigating the HTML to extract the desired information to store in the database.
Main Functions:
... | StarcoderdataPython |
8111250 | <reponame>phnomcobra/valarie-content<gh_stars>0
#!/usr/bin/python
FILE_HANDLE_TIME_OUT = 60
PROCESS_HANDLE_TIME_OUT = 60 * 60 * 8
import sys
import traceback
from subprocess import Popen, PIPE
from threading import Timer, Lock, Thread
from time import time
from Queue import Queue, Empty
from utils import sucky_uuid
... | StarcoderdataPython |
3476420 | <reponame>mattwigway/sqmake<filename>sqmake/makefile.py
# Copyright 2020 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0... | StarcoderdataPython |
9684946 | <reponame>MoZeWei/Data_Mining_Algorithm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 4 15:18:19 2018
@author: justintimberlake
"""
import numpy as np
'''
class SVM:
def __init__(self):
pass
def GetTrainData(self,data_x,data_y):
pass
def Train(self,data_... | StarcoderdataPython |
47187 | from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Sequence, Type, TypeVar
from eth._utils.datatypes import Configurable
from eth.constants import ZERO_HASH32
from eth_typing import BLSSignature, Hash32
from eth_utils import humanize_hash
from ssz.hashable_container import HashableContainer, SignedH... | StarcoderdataPython |
9648252 | <reponame>DebVortex/suggestion_bot
import sys
import os
import re
from discord.ext.commands import Bot
from database.models import Suggestion
SUMMARY_REGEX = r'.*\[(?P<summary>.*)\].*'
from .utils import get_votes, UPVOTE, DOWNVOTE
class SuggestionBot(Bot):
def __init__(self, logger, *args, **kwargs):
... | StarcoderdataPython |
12849427 | from django.conf.urls import patterns, url
from quotes import views
from views import *
urlpatterns = patterns('',
url(r'^sdf$', index, name='index'),
url(r'^$', GameView.as_view(), name='game'),
url(r'^post$', AnswerView.as_view(), name='answer'),
url(r'^edit$', QuoteUpdate.as_view(), name='update'),
)
... | StarcoderdataPython |
5134030 | <filename>test.py
### Source code / logs
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import ... | StarcoderdataPython |
134539 | from time import sleep
from pycrunch_trace.client.api import trace
def alternative_ways_to_trace():
sleep(0.25)
print('You can use Trace object to manually start and stop tracing')
print(' Or by applying @trace decorator to the method')
print(' See examples bellow')
def example_without_decorators():... | StarcoderdataPython |
219319 | <filename>send_non_tls.py<gh_stars>0
import pika
import ssl
credentials = pika.PlainCredentials('test', 'test')
parameters = pika.ConnectionParameters(
host='localhost',
port=5672,
virtual_host='/',
credentials=credentials
)
connection = pika.BlockingConnection(parameters)
channel = connection.chann... | StarcoderdataPython |
1901614 | <reponame>ska-sa/katsdpscripts<filename>rts_deploy/fabfile.py<gh_stars>0
import rts_dc
import rts_imager
import rts_timeplot
| StarcoderdataPython |
5020126 | #!/usr/bin/env python
"""Tests for the hunt database api."""
import re
from absl.testing import absltest
from grr_response_server.databases import db_test_utils
class TestOffsetAndCountTest(db_test_utils.QueryTestHelpersMixin,
absltest.TestCase):
def testDoesNotRaiseWhenWorksAsExpec... | StarcoderdataPython |
11313092 | # python3
# Copyright 2021 InstaDeep Ltd. 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 applic... | StarcoderdataPython |
5035585 | from pyomo import environ as po
from pyomo import dae as pod
from matplotlib import pyplot as plt
import numpy as np
def create_model_hgp(spt):
m = po.ConcreteModel()
tau = max(spt)
norm_spt = spt / tau
m.t = pod.ContinuousSet(bounds=(0, 1), initialize=norm_spt) # normalized time variable (unitle... | StarcoderdataPython |
4911795 | import pytest
import pandas as pd
import numpy as np
import pandas.util.testing as tm
pytest.importorskip('rbc')
def catch_udf_support_disabled(mth):
def new_mth(self, con):
try:
return mth(self, con)
except Exception as msg:
if type(
msg
).__na... | StarcoderdataPython |
1973208 | <reponame>ipa-cmh/bonsai
#Copyright (c) 2017 <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, ... | StarcoderdataPython |
4835787 | <filename>lldb/scripts/Python/prepare_binding_Python.py
"""
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Python binding preparation script.
"""
# Python modules:
from __fu... | StarcoderdataPython |
5001217 | <reponame>pianoft/FlaskPrimeFactorization
DEBUG=True
SQLALCHEMY_DATABASE_URI='sqlite:///flask_blog.db'
SQLALCHEMY_DATABASE_TRACK_MODIFICATIONS=True
SECRET_KEY='secret key'
USERNAME='a'
PASSWORD='' | StarcoderdataPython |
12847600 | <gh_stars>1-10
import os
from argparse import ArgumentParser
import requests
import json
import traceback
LOCATIONS = [
"Aruba",
"Afghanistan",
"Africa",
"Angola",
"Albania",
"Andorra",
"Andean Region",
"Arab World",
"United Arab Emirates",
"Argentina",
"Armenia",
"American Samoa",
"Antigua a... | StarcoderdataPython |
4823803 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template
from flask_login import login_required
from vhoops import authorize, user_groups
from vhoops.modules.users.forms.new_user import NewUser
from vhoops.modules.teams.api.models import Teams
users_router = Blueprint("us... | StarcoderdataPython |
1870004 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Trace GUI."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import logging
from pathlib import Path
import numpy as np
from phylib.io.model import load... | StarcoderdataPython |
11204004 | # coding:utf-8
class HtmlStorer(object):
def store_db(self, html):
pass
def store_file(self, html):
pass
| StarcoderdataPython |
1745503 | <reponame>a-fox/indy-node
from copy import deepcopy
from typing import List
import base58
from indy_common.auth import Authoriser
from indy_common.constants import NYM, ROLE, ATTRIB, SCHEMA, CLAIM_DEF, REF, \
GET_NYM, GET_ATTR, GET_SCHEMA, GET_CLAIM_DEF, SIGNATURE_TYPE, REVOC_REG_DEF
from indy_common.roles import... | StarcoderdataPython |
191110 | <reponame>XiaohanZhangCMU/spinningup
# Demonstrate
# 1. Pearlmutter hvp theory works
# 2. j-towns 3 backward prop trick works
from autograd import numpy as np
import autograd.numpy.random as npr
from autograd.test_util import check_grads, check_equivalent
from autograd import (grad, elementwise_grad, jacobian, value_a... | StarcoderdataPython |
5018467 | <filename>test/__init__.py
import sys
sys.path.append('~/PycharmProjects/kawalc1') | StarcoderdataPython |
189117 | <filename>NTA_detect_fast_flux.py
#!/usr/bin/env python2
from scapy.all import *
records = {}
min_count = 5 # we only care if the domain name has more than min_count IPs associated with it.
def examine(pk):
if pk.haslayer(DNSRR):
rname = pk.getlayer(DNSRR).rrname
rdata = pk.getlayer(DNSRR).rdata... | StarcoderdataPython |
9692561 | <gh_stars>1-10
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
from apps.E_business_project_admin.serializers.image import ImageSeriazlier, SKUSeriazlier
from apps.E_business_project_admin.utils import PageNum
from apps.goods.models... | StarcoderdataPython |
6512410 | import json
import pandas as pd
def create_csv(json_blob, path_for_csv):
# with open(json_blob.name) as file:
#data = json.load(file)
json_string = json_blob.download_as_string()
data = json.loads(json_string)
# dicts where Im gonna save the info for the csv, key = page-number, value = list of at... | StarcoderdataPython |
6550498 | <filename>tests/test_usage.py
from mock import patch, Mock
from nose.tools import raises
from tests.tools import create_mock_json
from twilio.rest.resources import Usage
from twilio.rest.resources.usage import UsageTriggers, UsageTrigger
BASE_URI = "https://api.twilio.com/2010-04-01/Accounts/AC123"
ACCOUNT_SID = "AC1... | StarcoderdataPython |
359169 | <reponame>Strategy-Tap/Novizi-BackEnd<gh_stars>0
"""Collection permissions."""
from typing import Any
from django.utils import timezone
from rest_framework import permissions
from rest_framework.request import Request
class IsOwnerOrReadOnly(permissions.BasePermission):
"""Allows full access to object owner othe... | StarcoderdataPython |
5194807 | <reponame>ondiiik/meteoink<filename>simulator/machine.py
import sys
import time
import datetime
import pygame
class SPI:
def __init__(self, n):
pass
def init(self, baudrate, polarity, phase, sck, mosi, miso):
pass
_pins = [1] * 256
_pins[32] = 1 # 1 - Meteostation, 0 - Config server
... | StarcoderdataPython |
327381 | from .myHeartCounts import MyHeartCounts
| StarcoderdataPython |
12830248 | <gh_stars>10-100
# Copyright (C) 2015-2021 by Vd.
# This file is part of Rocketgram, the modern Telegram bot framework.
# Rocketgram is released under the MIT License (see LICENSE).
from io import BytesIO
from rocketgram import api
def test_GetUpdates():
req = api.GetUpdates()
assert req.render() == {}
... | StarcoderdataPython |
3366034 | from scipy import sparse
from boosts.hole_boost import HoleBoost
from boosts.tail_boost import TailBoost
from boosts.album_boost import AlbumBoost
from boosts.match_boost import MatchBoost
from utils.post_processing import *
from utils.submitter import Submitter
from utils.pre_processing import *
def submission(boost... | StarcoderdataPython |
11378461 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012, <NAME>
#
# This file is part of statio released under MIT license.
# See the LICENSE for more information.
"""
Collection of functions used to calculate statistics.
The _values functions typically run over a sliding window and return
a list of comp... | StarcoderdataPython |
9727337 | <reponame>paolostivanin/exam<gh_stars>10-100
from functools import partial
from operator import eq, ne
IRRELEVANT = object()
class ChangeWatcher(object):
POSTCONDITION_FAILURE_MESSAGE = {
ne: 'Value did not change',
eq: 'Value changed from {before} to {after}',
'invalid': 'Value changed... | StarcoderdataPython |
5025309 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Required, Email, EqualTo, ValidationError
from ..models import User
class RegistrationForm(FlaskForm):
email = StringField('<EMAIL>', validators=[Required(), Email()])
username =... | StarcoderdataPython |
6504942 | <filename>parseq/scripts_compgen/basic_ib.py
import json
import os
import random
import re
import shelve
from copy import deepcopy
from functools import partial
from typing import Dict
import wandb
import qelos as q
import torch
import numpy as np
from torch.utils.data import DataLoader
from parseq.datasets import S... | StarcoderdataPython |
1840209 | import game
import policy_value_net_numpy
import pickle
import operator
import json
import numpy as np
#TODO: delete the following paths -lines
#board_file_path = "board_file_6.txt"
#model_file = 'best_policy_8_8_5.model'#'best_policy_6_6_4.model'
def file_to_board(board_file_path,rows_num, cols_num, X="X",O="O",empt... | StarcoderdataPython |
1889876 | <reponame>QinHan-Erin/AMOS<filename>python/tvm/tensor_graph/testing/models/__init__.py
from .shufflenet import ShuffleNet
from .capsule_tg import CapsuleNetwork
from .LLTM import LLTM
from .MI_LSTM import MI_LSTM
from .transformer import Transformer
from .resnet import resnet18, resnet50
from .mobilenet_v1 import Mobil... | StarcoderdataPython |
1628635 | ##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by <NAME>, <EMAIL>, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://gith... | StarcoderdataPython |
6642038 | import math
import numpy as np
from .augmentor import DataAugment
class MissingSection(DataAugment):
"""Missing-section augmentation of image stacks
Args:
num_sections (int): number of missing sections.
p (float): probability of applying the augmentation.
"""
def __init__(self, num... | StarcoderdataPython |
3527778 | <gh_stars>0
"""
@package mi.dataset.driver.WFP_ENG.STC_IMODEM.driver
@file marine-integrations/mi/dataset/driver/WFP_ENG/STC_IMODEM/driver.py
@author <NAME>
@brief Driver for the WFP_ENG__STC_IMODEM
Release notes:
initial release
"""
__author__ = '<NAME>'
__license__ = 'Apache 2.0'
from mi.core.common import BaseEnu... | StarcoderdataPython |
3256974 | <reponame>LaudateCorpus1/python-grafeas
# -*- coding: utf-8 -*-
# Copyright 2020 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
... | StarcoderdataPython |
11230891 | <filename>Python-programming-1/nonDivisableSubset.py
from itertools import combinations
def nonDivisibleSubset(k, s):
# Write your code here
res=[]
for pair in list(combinations(s, 2)):
if sum(pair)%k != 0:
# print(res, pair)
res+=list(pair)
print(set(res))
return l... | StarcoderdataPython |
9731955 |
# encoding: utf-8
__author__ = "<NAME>"
__email__ = "schmidt89 at informatik.uni-marburg.de"
'''
Utility functions for mongodb.
'''
from androlyze.log.Log import log
from androlyze.model.script.ScriptUtil import dict2json
from androlyze.storage import Util
from gridfs.grid_file import GridOutCursor
from pymongo.cur... | StarcoderdataPython |
1841777 | <reponame>cheikhsidi/Sharepoint_To_SQL
from sqlalchemy import create_engine, Table, Column, Integer, Unicode, MetaData, String, Text, update, and_, select, func, types
from sqlalchemy.ext.automap import automap_base
import sql_connect as secret
pwd1 = <PASSWORD>.password
# create engine, reflect existing columns,... | StarcoderdataPython |
6680975 | <filename>pygradsreader.py
import numpy
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import re
import glob
class Grads():
"""
grads形式のデータをnumpy配列に変換するクラス
"""
@classmethod
def read_ctlfile(cls,ctlfile):
ctl={}
for line in f:
info=re.split(" +",line.rstrip("\r... | StarcoderdataPython |
92080 | # coding: utf-8
"""
1Password Connect
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.2.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | StarcoderdataPython |
12854221 | <filename>pymtl3/passes/rtlir/structural/__init__.py
"""Expose structural RTLIR generation pass.
PyMTL user should only interact with the passes exposed here.
"""
from .StructuralRTLIRGenL4Pass import StructuralRTLIRGenL4Pass as StructuralRTLIRGenPass
| StarcoderdataPython |
9734305 | <gh_stars>0
# Copyright 2018 Iguazio
#
# 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 wri... | StarcoderdataPython |
11284522 | # -*- coding: utf-8 -*-
from Headset import Headset
from Bracelet import Bracelet
import time
headsetPort = 'COM3'
braceletPort = 'COM4'
headset = Headset()
bracelet = Bracelet()
try:
headset.connect(headsetPort, 9600)
except Exception, e:
raise e
try:
bracelet.connect(braceletPort, 9600)
except Except... | StarcoderdataPython |
1904243 | import svgwrite
from bplot import svgbase
import math
class SVGObject(object):
def __init__(self,
stroke = 'black', stroke_width = 1,
stroke_dasharray=[], stroke_lines=['outline'], stroke_pattern=[1,1,1,1],
fill='white', opacity=1,
):
self._dwg = svgwrite.D... | StarcoderdataPython |
3269674 | # -*- coding:utf-8 -*-
"""
@author:SiriYang
@file: CategoryView.py
@time: 2020.1.28 21:13
"""
import sys
import ui
import console
from AppsTableView import AppsTableView
sys.path.append("..")
from AppService import AppService
from tools.Result import *
class CategoryView(ui.View):
def __init__(self,app,father):... | StarcoderdataPython |
1968632 | <reponame>sirikata/sirikata
#!/usr/bin/python
import feedparser
import urllib
import os.path
import os
import time
import pickle
import zipfile
import xml.dom.minidom
import math
import euclid
import subprocess
def extract_entity_id(entity_url):
id_url_prefix = 'http://sketchup.google.com/3dwarehouse/data/entitie... | StarcoderdataPython |
98280 | <filename>usaspending_api/recipient/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-05-11 00:51
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.indexes
import partial_index
from django.contrib.postgres.operations impo... | StarcoderdataPython |
3241624 | #vse mozne kombinacije a**b za 2 <= a <= 100 enak za b
def vse_kombinacije(od, do):
sez_kombinacij = []
for osnova in range(od, do + 1):
for potenca in range(od, do + 1):
if osnova ** potenca not in sez_kombinacij:
sez_kombinacij.append(osnova ** potenca)
return len(sez_... | StarcoderdataPython |
11201726 | # coding=utf-8
'''
accuracy:98%
'''
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
print(mnist.train.images.shape, mnist.train.labels.shape)
X_SIZE = 784
Y_SIZE = 10
LR = 0.5
BATCH_SIZE = 100
STEP_TIMES = 4000
UNIT_NU... | StarcoderdataPython |
303618 | # -*- coding: utf-8 -*-
"""
Transitive closure
===================
Computes transitive closure on a graph Adjacency Matrix.
These algorithms work with undirected weighted (distance) graphs.
"""
# Copyright (C) 2017 by
# <NAME> <<EMAIL>>
# All rights reserved.
# MIT license.
import numpy as np
import heapq... | StarcoderdataPython |
149160 | """
Copyright 2018 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
11366554 | <reponame>fgitmichael/AutoregressiveModeDisentangling<gh_stars>0
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.distributions import Normal
from code_slac.network.base import BaseNetwork
from code_slac.network.latent import Gaussian, ConstantGaussian
class ModeL... | StarcoderdataPython |
345650 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-18 13:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('departmentsApp', '0006_remove_department_preque... | StarcoderdataPython |
11348978 | <gh_stars>1000+
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class PaymentTe... | StarcoderdataPython |
4837118 | <reponame>git-men/bsm-django
from rest_framework.permissions import IsAdminUser as OriginIsAdminUser
from django.conf import settings
from api_basebone.utils.sign import common_make_sign
class IsAdminUser(OriginIsAdminUser):
"""
Allows access only to admin users.
这里使用了签名认证和原有的会话认证
如果请求的头部包含了签名的参数,... | StarcoderdataPython |
8168810 | <reponame>markusmeingast/Airfoil-GAN
"""
This is an implementation of a conditional GAN (CGAN) network. The generator
predicts and image (in this case the number of points along the profile in x and
y).This is done by combining parameter terms as well as random noise, as well as
employing a gaussian blur to smooth the ... | StarcoderdataPython |
1940983 | class Solution:
def isBoomerang(self, points: List[List[int]]) -> bool:
x1, y1 = points[0]
x2, y2 = points[1]
x3, y3 = points[2]
return (y1 - y2) * (x1 - x3) != (y1 - y3) * (x1 - x2)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.