id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
198882 | <gh_stars>1-10
#!/usr/bin/env python
import os
import sys
if len(sys.argv) == 1:
print("usage: script.py cazy_annotations.tsv")
sys.exit(1)
with open(sys.argv[1]) as fin:
next(fin)
for line in fin:
cazy = set()
line = line.rstrip()
cols = line.split("\t")
for col in co... | StarcoderdataPython |
107352 | <gh_stars>0
import logging
import flet
from flet import Slider, Stack, Text
logging.basicConfig(level=logging.DEBUG)
with flet.page("horizontal-stack-wrapping") as page:
bg_color = "#ddddee"
page.horizontal_align = "stretch"
def items(count):
return [
Text(
value=i +... | StarcoderdataPython |
3270091 | <gh_stars>0
#!/usr/bin/python3
import sys
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
from hermite import BezierSpline, HermiteSpline, ArclenHermiteSpline
def figure_bezier_spline():
control_points = np.array([
[0, 0], [0.5, 5], [5.2, 5.5], [3, 2.2]
])
labels ... | StarcoderdataPython |
1629692 | <reponame>trawick/edurepo<gh_stars>0
from tastypie import fields
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS
from resources.models import Resource, ResourceSubmission, ResourceVerification
from core.utils import CORSResource
from repo.api import LearningObjectiveResource
class ResourceResource(CO... | StarcoderdataPython |
3338213 | __author__ = 'yossiad'
def wer(r, h):
"""
Calculation of WER with Levenshtein distance.
Works only for iterables up to 254 elements (uint8).
O(nm) time ans space complexity.
wer("who is there".split(), "is there".split())
1
wer("who is there".split(), "".split())
... | StarcoderdataPython |
3374333 | """
This file is part of nucypher.
nucypher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
nucypher is distributed in the hope that it wil... | StarcoderdataPython |
1786268 | <filename>pyjobs/core/templatetags/core_tags.py
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def merge_query_params(context, **kwargs):
query_params = context["request"].GET.copy()
for k, v in kwargs.items():
query_params[k] = v
return query... | StarcoderdataPython |
1734195 | """
[11/14/2012] Challenge #112 [Easy]Get that URL!
https://www.reddit.com/r/dailyprogrammer/comments/137f7t/11142012_challenge_112_easyget_that_url/
**Description:**
[Website URLs](http://en.wikipedia.org/wiki/Uniform_resource_locator), or Uniform Resource Locators, sometimes embed
important data or arguments to be ... | StarcoderdataPython |
144926 | #
# Imports
#
from telegram_payment_bot._version import __version__
from telegram_payment_bot.payment_bot import PaymentBot
| StarcoderdataPython |
3292325 | #importar a biblioteca "os" para poder apagar o arquivo e manipular outras funções
import os
#importar a biblioteca para manipular as linhas dentro do arquvio
from io import StringIO
#definição da função Debitar(3ª opção)
def Debitar():
#solicitação para o usuário das variaveis necessárias para debitar(CPF, senha ... | StarcoderdataPython |
135672 | <gh_stars>0
#!/usr/bin/python
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/test/testcases/testExecutorPutRing.py $
#
# OpenPOWER sbe Project
#
# Contributors Listed Below - COPYRIGHT 2016
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version... | StarcoderdataPython |
3286346 | import ctypes
import os, sys
pyrender_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, pyrender_dir)
ctypes.cdll.LoadLibrary(os.path.join(pyrender_dir, 'pyrender.so'))
from pyrender import *
| StarcoderdataPython |
1672141 | import json
import responses
from django.conf import settings
class TestViews():
@responses.activate
def test_get_controller_page(self, client, db, response_ok):
"""/ (GET) returns html page with sensors data."""
controller_url = settings.SMART_HOME_API_URL
headers = {'Authorization'... | StarcoderdataPython |
1735541 | <filename>2021/10/solution1.py<gh_stars>1-10
from collections import deque
opens = ["(", "[", "{", "<"]
closes = [")", "]", "}", ">"]
scores = {
")": 3,
"]": 57,
"}": 1197,
">": 25137,
}
with open("input.txt") as input_file:
lines = input_file.read().splitlines()
queue = deque()
final_score = 0
... | StarcoderdataPython |
49489 | <reponame>cd109/scrappybara
import unittest
from scrappybara.preprocessing.tokenizer import Tokenizer
_TOKENIZE = Tokenizer()
class TestTokenizer(unittest.TestCase):
# BLOCKS
# -------------------------------------------------------------------------->
def test_indirect_speech_blocks(self):
se... | StarcoderdataPython |
166704 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from helpers.unit import UnitHelper
from helpers.zmq import ZMQHelper
from mocks.bondster.server import BondsterMock
from mocks.vault.server import VaultMock
from mocks.ledger.server import LedgerMock
from helpers.statsd import StatsdHelper
from helpers.logger import logg... | StarcoderdataPython |
4825588 | from django.apps import AppConfig
class TechnicalTagConfig(AppConfig):
name = 'technical_tag'
| StarcoderdataPython |
30288 | from cgi import FieldStorage
from datetime import date
from io import BytesIO
from onegov.core.utils import Bunch
from onegov.form import Form
from onegov.wtfs.fields import HintField
from onegov.wtfs.fields import MunicipalityDataUploadField
class PostData(dict):
def getlist(self, key):
v = self[key]
... | StarcoderdataPython |
1789562 | <gh_stars>1-10
# -*- coding: utf-8 -*-
__all__ = ('SpoonAnalyser',)
from typing import Any, Iterator, List, Mapping, Sequence
import contextlib
import json
import os
import shlex
import subprocess
from dockerblade import DockerDaemon as DockerBladeDockerDaemon
from loguru import logger
import attr
from .analysis imp... | StarcoderdataPython |
1608326 | <reponame>solideveloper/afs-210
# Write the missing code in the HashTable class for the following methods:
# hashfunction
# rehash
# put
# get
# Create a hash table with a size of 10.
# The primary hash function will use key modulus table_size
# Resolve collisions using double hashing where the secondary hash fu... | StarcoderdataPython |
59159 | CHANGE_PW = {
'tags': ['회원가입 이후'],
'description': '비밀번호 변경',
'parameters': [
{
'name': 'Authorization',
'description': 'JWT Token',
'in': 'header',
'type': 'str'
},
{
'name': 'pw',
'description': '변경할 비밀번호',
... | StarcoderdataPython |
1708913 | import argparse
from os import path
from datetime import datetime
import logging
from logging.config import fileConfig
import tempfile
from dicom.dataset import Dataset
from mip import Pacs, DicomAnonymizer
# parse commandline
parser = argparse.ArgumentParser(description='Download and anonymize files from a PACS syst... | StarcoderdataPython |
3226676 | from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView
from django import forms
from django.core.validators import validate_image_file_extension
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from dash.categories.fields import CategoryChoiceFiel... | StarcoderdataPython |
38746 | <gh_stars>0
from operator import index
from fastapi.testclient import TestClient
from index import app
client = TestClient(app)
def test_get_item():
response = client.get("/articles/10000")
assert response.status_code == 200
assert response.json() == {"id": 10000,
"title": ... | StarcoderdataPython |
3267845 | # -*- coding: utf-8 -*-
__author__ = 'gzp'
from utils import Tree
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findTilt(self, root):
"""
:type root: TreeNode
... | StarcoderdataPython |
1619644 | <gh_stars>1-10
#!/usr/bin/env python
"""
Name: alignments_from_stacks_fasta.py
Author: <NAME>
Date: 6 June 2014
Description: Convert the fasta output from the populations module of the Stacks (Catchen et al.
2013) pipeline to alignments for coalescent analyses. Warning messages will be printed if the
number of all... | StarcoderdataPython |
3202450 | <filename>docs/support/trace_support.py<gh_stars>1-10
# trace_support.py
# Copyright (c) 2013-2019 <NAME>
# See LICENSE for details
# pylint: disable=C0111,C0411,E0401,E0611,W0212
# Standard library imports
from __future__ import print_function
import collections
import copy
import datetime
import os
import warnings
... | StarcoderdataPython |
4817296 | <filename>calc.py
import requests
def calc(expr):
url = "http://api.mathjs.org/v1/?expr=%s" % expr
r = requests.get(url)
if r.text != "":
return r.text
if r.text == "undefined":
return "Méo biết!"
return "Méo hiểu!"
| StarcoderdataPython |
82924 | <filename>third_party/OpenFace/model_training/ce-clm_training/cen_training/train_cen.py
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD, RMSprop, Adagrad, Adadelta, Adam, Adamax
from keras.constraints import max_norm, non_neg
from keras.callbacks... | StarcoderdataPython |
197299 | __version__ = '0.0.6'
__all__ = ['elmo_ner', 'bert_ner', 'dataset_splitting', 'quality', 'utils']
| StarcoderdataPython |
1635492 | <reponame>amath574w2017/am574-class<filename>homeworks/hw3/plot_qbox.py
import matplotlib
matplotlib.rc('text', usetex = True)
from pylab import *
figure(3)
clf()
plot([-1,1.5],[0,0],'k')
plot([-1,1.5],[0.5,0.5],'k')
plot([-1,-1],[0,.5],'k')
plot([1.5,1.5],[0,.5],'k')
plot([0,-1],[0,0.5],'b')
plot([0,1.5],[0,0.5]... | StarcoderdataPython |
3243220 | """
Overseer module for TensorFlow. It is an abstract class with self.train as the
abstract method which must be defined by inheriting classes for instantiation.
A overseer is a trainer that can perform unsupervised or supervised learning
with multiple learning schedule.
"""
# <NAME>
#------------------------------... | StarcoderdataPython |
1677611 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def forwards_func(apps, schema_editor):
EmailTemplate = apps.get_model("konfera", "EmailTemplate")
db_alias = schema_editor.connection.alias
text = """Dear {first_name} {last_name},\n\n
order with your ticket... | StarcoderdataPython |
4829388 | import string
import re
from nlpaug.util import Method
from nlpaug import Augmenter
from nlpaug.util import WarningException, WarningName, WarningCode, WarningMessage
class WordAugmenter(Augmenter):
TOKENIZER_REGEX = re.compile(r'(\W)')
def __init__(self, action, name='Word_Aug', aug_min=1, aug_max=10, aug_... | StarcoderdataPython |
120675 | import numpy as np
import pandas as pd
from functools import reduce
from itertools import combinations_with_replacement
from amlearn.featurize.base import create_featurizer_backend
from amlearn.utils.packing import load_radii
from sklearn.base import BaseEstimator, TransformerMixin
try:
from amlearn.featurize.src ... | StarcoderdataPython |
1790861 | #!/usr/bin/env python3
# precision.py - Precision program by Sergey 2015
# AlgoArt - The Art of Algorithms (github.com/algoart/algoart)
"""
Arbitrary precision math calculations.
decimal.getcontext().prec = p - setting the precision (Default: 40)
pi() - Calculates Pi with required precision
PI - precalculated valu... | StarcoderdataPython |
76612 | <gh_stars>0
__author__ = 'umasear'
import os
import unittest
import sys
from db_sqlite3 import get_db_row_count, write_energy_to_database, write_power_to_database, open_database, touch_site
from configparser import ConfigParser
parser = ConfigParser()
if len(sys.argv) > 1:
parser.read(sys.argv[1])
else:
par... | StarcoderdataPython |
78816 | import json
import uuid
from enum import Enum
from allauth.socialaccount.models import SocialAccount
from django.contrib.auth.models import AbstractUser
from django.db import models
from rest_framework import serializers
class EmailSocialAccount(SocialAccount):
class Meta:
proxy = True
def __str__(s... | StarcoderdataPython |
1621970 | <filename>src/051-100/P075.py
from collections import defaultdict
from numba import *
@jit
def compute_pytho():
pytho = defaultdict(int)
N = 1500000
lim = int(N**0.5)
print("Limiting search to : ", lim)
for n in range(1, lim + 1):
for m in range(n + 1, lim + 1):
a = m * m - ... | StarcoderdataPython |
3309917 | """PyAudio example: Record a few seconds of audio and save to a WAVE file."""
import pyaudio
import wave
import datetime
import os.path
import sys
import audioop
import time
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
SAVE_PERIOD = 10
THRESHOLD = 1000
SILENCE_DETECTION = 20
WAVE_OUTPUT_FILENAME = ... | StarcoderdataPython |
4805399 | from keys import key, secret
import os
path = os.path.dirname(os.path.abspath(__file__))
from boto.s3.key import Key
from boto.s3.connection import S3Connection
conn = S3Connection(key, secret)
uninstall_bucket = conn.get_bucket('uninstall.amon.cx')
install_bucket = conn.get_bucket('install.amon.cx')
contrib_bucket =... | StarcoderdataPython |
21869 | # -*- coding: utf-8 -*-
'''
:synopsis: Unit Tests for Windows IIS Module 'module.win_iis'
:platform: Windows
:maturity: develop
versionadded:: Carbon
'''
# Import Python Libs
from __future__ import absolute_import
import json
# Import Salt Libs
from salt.exceptions import SaltInvocationError
from salt... | StarcoderdataPython |
3390654 | # -*- coding: utf-8 -*-
#% $Id$
#
#
# Copyright (C) 2002-2007
# The MeqTree Foundation &
# ASTRON (Netherlands Foundation for Research in Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | StarcoderdataPython |
1607989 | <filename>citydata/final/mergeScore/plotdistance.py<gh_stars>1-10
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
import seaborn as sns
def LoadScore(data, key):
result = np.zeros(len(data))
for index, row in data.iterrows():
result[index] = row[key]
return result
totaldata... | StarcoderdataPython |
3328248 | import torch
import torch.utils.data
import torchaudio
import os
import soundfile as sf
import numpy as np
import configparser
import multiprocessing
import json
import pandas as pd
from subprocess import call
class Config:
def __init__(self):
pass
def read_config(config_file):
config = Config()
parser = configp... | StarcoderdataPython |
60852 | <filename>MPAtt/tools/avdataCombine.py
"""
1.avdataCombine()--->avdata/avdata_org.mat
2.dataNormalize()--->avdata/avdata_nor.mat
3.getVisualWeight
4.getAudioWeight
5.concatenate audio-visual weight--->avdata/avweight.mat
6.save as separate samples
"""
import numpy as np
import os
import h5py
import scipy.io as scio
fr... | StarcoderdataPython |
9769 | import setuptools
long_description = """
# Coldtype
### Programmatic display typography
More info available at: [coldtype.goodhertz.com](https://coldtype.goodhertz.com)
"""
setuptools.setup(
name="coldtype",
version="0.6.6",
author="<NAME> / Goodhertz",
author_email="<EMAIL>",
description="Funct... | StarcoderdataPython |
1764549 | """
Line Chart with Percent axis
----------------------------
This example shows how to format the tick labels of the y-axis of a chart as percentages.
"""
# category: line charts
import altair as alt
from vega_datasets import data
source = data.jobs()
(
alt.Chart(source)
.mark_line()
.encode(
alt... | StarcoderdataPython |
3211117 | import curses
import os
from multiprocessing import Process
from typing import Any
from initload import initialize
from play_sounds import play_file as playsound
from utils.palettes import palettes
# Curses setup
screen = curses.initscr()
curses.noecho()
# curses.cbreak()
curses.start_color()
curses.can_change_color(... | StarcoderdataPython |
120443 | import torch
from collections import OrderedDict, defaultdict
if __name__ == '__main__':
net = torch.load('/home/dingyangyang/SOLO/work_dirs/solov2_attention_label_align2_assim/stage2_epoch_8_0.399.pth')
state_dict = OrderedDict()
for k, v in net['state_dict'].items():
# print(k, v.shape)
... | StarcoderdataPython |
3256540 | <filename>model.py
import torch
from torch import nn
class InstaGAN(object):
"""
InstaGANの2組のGeneratorとDiscriminatorを保持するためのクラスです。
"""
def __init__(self, params):
super(InstaGAN, self).__init__()
network_params = params["network"]
input_nc = network_params["input... | StarcoderdataPython |
1609197 | # coding=utf-8
import copy
import unittest
import test_data
from ndb import operate
class NodeSelectTest(unittest.TestCase):
'''
Node Select Unit Test
'''
def setUp(self):
self.node = copy.deepcopy(test_data.node)
def test_select(self):
result = operate.select(... | StarcoderdataPython |
3240670 | <gh_stars>0
from django import VERSION as django_version
if django_version[0] >= 2:
from django.urls import path
else:
from django.conf.urls import url
from .views import PostListCreateView, SerializerNotSetView
if django_version[0] >= 2:
urlpatterns = [
path("blog/posts", PostListCreateView.as_vi... | StarcoderdataPython |
3256066 | <filename>taxontabletools/get_available_meta_data.py
def get_available_meta_data(TaXon_table_xlsx, path_to_outdirs):
import os
import pandas as pd
from pandas import DataFrame
from pathlib import Path
TaXon_table_xlsx = Path(TaXon_table_xlsx)
meta_data_xlsx = Path(str(path_to_outdirs) + "/" + ... | StarcoderdataPython |
1707611 | #!/usr/bin/env python3
import warnings
import torch
from .. import settings
from ..utils import broadcasting, pivoted_cholesky, woodbury
from .diag_lazy_tensor import DiagLazyTensor
from .psd_sum_lazy_tensor import PsdSumLazyTensor
from .root_lazy_tensor import RootLazyTensor
from .sum_lazy_tensor import SumLazyTens... | StarcoderdataPython |
68553 | # list examples
z=[1,2,3]
assert z.__class__ == list
assert isinstance(z,list)
assert str(z)=="[1, 2, 3]"
a=['spam','eggs',100,1234]
print(a[:2]+['bacon',2*2])
print(3*a[:3]+['Boo!'])
print(a[:])
a[2]=a[2]+23
print(a)
a[0:2]=[1,12]
print(a)
a[0:2]=[]
print(a)
a[1:1]=['bletch','xyzzy']
print(a)
a[:0]=a
print(a)
a[:]=[... | StarcoderdataPython |
1637981 | <filename>kivyauth/utils.py
from kivy.utils import platform
if platform == "android":
def stop_login(*args):
pass
elif platform != "ios":
from kivyauth.desktop.utils import stop_login
class LoginProviders:
google = "google"
facebook = "facebook"
github = "github"
twitter = "twitter... | StarcoderdataPython |
3205691 | import numpy as np
from pydantic import ValidationError
from sklearn.model_selection import train_test_split
from regression_model.config.core import config
from regression_model.pipeline import price_pipe
from regression_model.processing.data_manager import load_dataset, save_pipeline
from regression_model.processing... | StarcoderdataPython |
3324566 | """
THE WATER BUCKETS PROBLEM
(Description is from http://www.openbookproject.net/py4fun/buckets/buckets.html
but see also https://en.wikipedia.org/wiki/Liquid_water_pouring_puzzles, as many
variations can be found.)
You go to the well with a 7 liter bucket and an 11 liter bucket. You wish to
fill one of them with ex... | StarcoderdataPython |
3356148 | <filename>benchexec/tablegenerator/statistics.py
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import collections
from decimal import Decima... | StarcoderdataPython |
1701668 | from django.test import tag
from test_plus import TestCase
from qa_moderator.events.tests.factories import EventFactory
from qa_moderator.questions.forms import QuestionForm
from qa_moderator.questions.models import Question
class TestQuestionForm(TestCase):
@tag('TO-FIX')
def test_save(self):
event... | StarcoderdataPython |
34618 | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... | StarcoderdataPython |
1601512 | <gh_stars>0
import torch
import numpy as np
from PIL import Image
from tqdm import tqdm
import argparse
from pathlib import Path
from inference import inference
from misc import post_proc, panostretch, utils
from model import HorizonNet
from preprocess import preprocess
# from reconstruction.make_3D_model import Cuboi... | StarcoderdataPython |
42989 | <gh_stars>0
import os
import time
from ctypes import *
from math import pi
from .. import __file__
module_path = os.path.dirname(__file__)
action_joints = [
'r_sho_pitch',
'l_sho_pitch',
'r_sho_roll',
'l_sho_roll',
'r_el',
'l_el',
'r_hip_yaw',
'l_hip_yaw',
'r_hip_roll',
'l_hip_r... | StarcoderdataPython |
20459 | """ 2015-07-23
Perform coordinate conversions from the command line.
Uses
"""
import argparse
import pyperclip
# p1 = argparse.ArgumentParser()
# p1.add_argument('x')
# print p1.parse_args(['123'])
#
# p2 = argparse.ArgumentParser()
# p2.add_argument('-d', action='store_const',const='dak')
# print p2.p... | StarcoderdataPython |
189688 | <gh_stars>1-10
import os
import requests
import datetime
import json
def get_average_kilometerage(vrm, average=10000):
headers = {
"x-api-key": os.getenv('MOT_API_KEY'),
"Content-Type": "application/json",
}
response = requests.get(
os.getenv('MOT_API_URL'), params={"registration":... | StarcoderdataPython |
3380268 | from dent.RectangleObjects import RectangleObject
import dent.TextureManager
import dent.Texture
import dent.Shaders
def make_irradience_map(input_texture):
render_stage = dent.RenderStage.RenderStage()
render_stage.reshape(input_texture.width, input_texture.height)
render_stage.load(input_texture.width, ... | StarcoderdataPython |
1696491 | #!/usr/bin/env python
# integeral.py
import numpy as num
def integral(x,y):
"""
ROUTINE: INTEGRAL
USEAGE: RESULT = INTEGRAL( X, Y )
PURPOSE: Integrate tabulated data using Simpson's rule
with 3-point Lagragian interpolation. Data may be
regularly sampled in X, ... | StarcoderdataPython |
1615025 | import pandas as pd
import scipy.stats.mstats
def normalized_count_table(
feature_count_table,
feature_count_start_column,
feature_count_end_column,
ref_feature_count_table,
ref_feature_count_start_column,
ref_feature_count_end_column,
normalized_table,
... | StarcoderdataPython |
3350311 | <filename>orchestra/contrib/services/tests/functional_tests/test_job.py
from django.contrib.contenttypes.models import ContentType
from orchestra.contrib.miscellaneous.models import MiscService, Miscellaneous
from orchestra.contrib.plans.models import Plan
from orchestra.utils.tests import random_ascii, BaseTestCase
... | StarcoderdataPython |
3291937 | <filename>third_party/pybind11/example/example-buffers.py
#!/usr/bin/env python
from __future__ import print_function
import sys
sys.path.append('.')
from example import Matrix
try:
import numpy as np
except ImportError:
# NumPy missing: skip test
exit(99)
m = Matrix(5, 5)
print(m[2, 3])
m[2, 3] = 4
pri... | StarcoderdataPython |
3225982 | <filename>open_spiel/python/algorithms/psro_v2/plot_curves/RD_iters.py
from numpy import genfromtxt
import numpy as np
import os
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import matplotlib as mpl
import math
from scipy.signal import savgol_filter
# yhat = savgol_filter(y, 51, 2) # windo... | StarcoderdataPython |
4841166 | <reponame>denmat/colorteller-aws-cdk<filename>colorteller_app/colorteller_app_stack.py
from aws_cdk import core, aws_ec2, aws_ecs, aws_iam, aws_ecr, aws_logs, aws_elasticloadbalancingv2, aws_servicediscovery
import os
class ColorTellerAppStack(core.Stack):
def __init__(self, scope, id, vpc, **kwarg) -> None:
... | StarcoderdataPython |
49719 | import os
import cv2
import gc
import random
import time
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import argparse
from glob import glob
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from PIL import Image, ImageFilter
from models.OEFT import OEFT
parse... | StarcoderdataPython |
1778863 | perguntas = {
'Pergunta1':{
'pergunta':'Quanto é 2 + 2?',
'respostas': {'a':2,'b':22,'c':4},
'resposta_certa':'c'
},
'Pergunta2':{
'pergunta':'Quanto é 2 - 2?',
'respostas': {'a':2,'b':0,'c':4},
'resposta_certa':'b'
}
}
acertos = 0
for pk,pv in perguntas.i... | StarcoderdataPython |
1792352 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import random
import yaml
from arg_parser import arg_parser
from twitter import Twitter, OAuth
idea_characters = (
u"🐵💭",
u"🐔💭",
u"🦄💭",
u"😮💭",
u"😇💭",
u"🤑💭",
u"👻💭",
u"😲💭",
u"😅💭",
... | StarcoderdataPython |
3327513 | <reponame>Forbu/fourier_neural_operator
"""
@author: <NAME>
This file is the Fourier Neural Operator for 2D problem such as the Darcy Flow discussed in Section 5.2 in the [paper](https://arxiv.org/pdf/2010.08895.pdf).
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.... | StarcoderdataPython |
4820239 | # Example single quart
singleQuart = 'spam eggs'
print(singleQuart)
escapeSingleQuart = 'doesn\'t'
# If you use Mac with JIS keyboard, type option + ¥ for inputting \.
print(escapeSingleQuart)
escapeSingleQuartwithDouble = "doesn't"
print(escapeSingleQuartwithDouble)
escapeDouble = '"Yes", he said.'
print(escapeDoub... | StarcoderdataPython |
1743339 | """A ContactController Module."""
from masonite.request import Request
from masonite.auth import Auth
from masonite.view import View
from masonite.validation import Validator
from masonite.controllers import Controller
from masonite.validation import MessageBag
from masonite import Mail
from masonite.validation.decora... | StarcoderdataPython |
1640234 | <reponame>Ravillatypov/macrobase
import asyncio
import random
import string
from typing import List, Dict, Type, Callable
from macrobase_driver import MacrobaseDriver
from macrobase_driver.config import CommonConfig, AppConfig, DriverConfig
from structlog import get_logger
from macrobase.hook import HookNames
from ma... | StarcoderdataPython |
1604362 | <reponame>liijunwei/Dev-Setup<filename>my-dotfiles/ranger/commands.py
# This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading... | StarcoderdataPython |
181318 | #!/usr/bin/env python3
# coding=utf-8
from math import ceil, floor
import librosa
from librosa import display
import numpy as np
import pandas as pd
import soundfile as sf
from collections import namedtuple
import re
def load_csv(filename: str, sep=',') -> pd.DataFrame:
# print('- loading %s' % filename)
cs... | StarcoderdataPython |
3235407 | <reponame>mef51/subdriftlaw<filename>universal/data/CHIME_FRB180814.J0422+73/numpyifier.py
#!/usr/bin/python
## convert CHIME .msgpack data to numpy arrays.
from cfod import chime_intensity as ci
import numpy as np
import os
# burstdirs = ['burst180814', 'burst180911', 'burst180917', 'burst180919']
# burstdirs = ['b... | StarcoderdataPython |
3283813 | <reponame>thautwarm/rmalt<filename>test.py
from rmalt.repl import main
main()
| StarcoderdataPython |
185783 | <reponame>douglassquirrel/combo
from web.env_urls import factspace_url, pubsub_url
from os.path import dirname, join as pathjoin
from web.factspace import Factspace
from web.pubsub import PubSub
from sys import stderr
with open(pathjoin(dirname(__file__), 'home.html')) as f:
HOME_HTML = f.read()
CHARSET = 'utf-8'
... | StarcoderdataPython |
17990 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2020 AVSystem <<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 ap... | StarcoderdataPython |
64906 | # -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | StarcoderdataPython |
3208144 | <gh_stars>0
# This module is home to an algorithm that explores a game tree of a battleship board, using a given bot. It then
# obtains a list of terminal states the board can arrive at. The purpose of this is to simulate the playing of probable
# games that can then be evaluated by a function which is in turn, optimis... | StarcoderdataPython |
3330497 | from Perceptron.functions.function import Function
class Heaviside(Function):
"""
Class representing the Heaviside function
"""
def __init__(self):
self.is_diff = False
def compute(self, a):
"""
Compute the Heaviside function on the given value
:argument a: argum... | StarcoderdataPython |
3269442 | import os
lr_list = [0.00007, 0.0003, 0.0005]
init_list = ["normal", "uniform"]
optim_list = ["adam", "rmsprop"]
act_list = ["relu", "elu"]
arch_list = ["100", "250,250", "500,500"]
drop_list =[0.1, 0.2]
for lr in lr_list:
for init in init_list:
for optim in optim_list:
for act in act_list:
... | StarcoderdataPython |
1624455 | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with th... | StarcoderdataPython |
3337656 | <gh_stars>0
import os
from packaging import version
from lastversion.lastversion import latest
# change dir to tests directory to make relative paths possible
os.chdir(os.path.dirname(os.path.realpath(__file__)))
def test_gitea_tags():
"""Simple Gitea test"""
repo = 'https://gitea.com/lastversion-test-repo... | StarcoderdataPython |
1780396 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2009 <NAME> All rights reserved.
#
"""
"""
#end_pymotw_header
import sys
import sys_shelve_importer
import os
import pkgutil
filename = '/tmp/pymotw_import_example.shelve'
sys.path_hooks.append(sys_shelve_importer.ShelveFinder)
sys.path.insert(0, filename)
im... | StarcoderdataPython |
4823963 | from tesla_powerwall.responses import PowerwallStatus
import unittest
from tesla_powerwall import Powerwall, GridStatus, SiteInfo, SiteMaster, MetersAggregates, Meter, MeterType, powerwall
from tests.integration import POWERWALL_IP, POWERWALL_PASSWORD
class TestPowerwall(unittest.TestCase):
def setUp(self) -> No... | StarcoderdataPython |
3297367 | <reponame>vuchau/scrapy-httpcache<gh_stars>1-10
remove_banned = object() | StarcoderdataPython |
1780086 | <reponame>dschultz0/awslarry<gh_stars>1-10
import unittest
import larry as lry
from larry.types import Box
from larry.utils import json_dumps, make_lambda_result_json_safe
import datetime
from botocore.exceptions import ClientError
import inspect
def simple_function(event, context):
print('simple log')
return... | StarcoderdataPython |
3368800 | from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Group,Permission
from meiduo_admin.serializers.groups import GroupSerializer
from meiduo_admin.serializers.permission import Permission... | StarcoderdataPython |
109970 | <reponame>fkromer/tt
"""Tools for working with Boolean expressions."""
from .bexpr import BooleanExpression # noqa
| StarcoderdataPython |
1684465 | <gh_stars>0
#!/usr/bin/env python3
from optparse import OptionParser
import os
import subprocess
from subprocess import Popen, PIPE
import sys
import re
import shutil
import glob
import datetime
import yaml
import common
this_directory = os.path.dirname(os.path.realpath(__file__)) + "/"
# This function will pull the... | StarcoderdataPython |
84860 | from twitchio.dataclasses import Message
from src.bot.botstates.BotState import BotState
class DefaultBot(BotState):
async def handle_event_message(self, msg: Message) -> None:
pass
async def handle_join(self, msg: Message) -> None:
pass
async def can_join(self, msg: Message) -> bool:
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.