id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1677647 | errorlog = '-'
accesslog = '-'
access_log_format = '{"remote_ip": "%(h)s", "uri": "%(r)s", ' \
'"response_code": %(s)s, "request_time": %(L)s}'
| StarcoderdataPython |
1666760 | <filename>cache-preload.py
#!/usr/bin/env python3
import asyncio
import multiprocessing
import time
import xml.etree.ElementTree as ET
from functools import partial
from pathlib import Path
from random import randint
import aiohttp
import async_timeout
import click
from selenium import webdriver
from selenium.webdrive... | StarcoderdataPython |
3268112 | <gh_stars>0
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<KEY>'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
EMAIL_BACKEND = 'django.core.mail.... | StarcoderdataPython |
3347008 | <filename>l10n_br_eletronic_document/models/account_move.py
import re
from datetime import datetime
from random import SystemRandom
from odoo import api, fields, models
from odoo.exceptions import UserError
TYPE2EDOC = {
'out_invoice': 'saida', # Customer Invoice
'in_invoice': 'entrada', # Vendor Bill
'... | StarcoderdataPython |
1724238 | import eel
import os
import glob
import shutil
import codecs
from OpenGL.GL import *
from OpenGL.WGL import *
from ctypes import *
import numpy
import pyaudio
import array
import re
class FileSystem():
def __init__(self):
self.categoryDir = './category'
self.extension = '.glsl'
... | StarcoderdataPython |
1700733 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | StarcoderdataPython |
131872 | #!/usr/bin/python
"""
Test XML character decoding against a range of encodings, valid and not."""
__author__ = "<NAME> <http://www.kafsemo.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2004, 2006 <NAME>"
import os, sys
import codecs
import re
curdir = os.path.abspath(os.path.dirname(__file__))
sr... | StarcoderdataPython |
176963 | <gh_stars>1-10
# missing last quote, escaped
a = 1 # make below not a doc comment
<error descr="Missing closing quote [']">'abc\'</error>
| StarcoderdataPython |
191584 | <filename>cellpack/mgl_tools/upy/examples/BasicGeom.py
"""
Copyright (C) <2010> <NAME>
This file git_upy/examples/BasicGeom.py is part of upy.
upy 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 Fou... | StarcoderdataPython |
111513 | import copy
import pickle
from pathlib import Path
from typing import Set
from networkx.classes.digraph import DiGraph
from networkx.classes.function import (
set_edge_attributes,
set_node_attributes,
non_edges,
)
from src.data.scripts.utils import apx2nxgraph, nxgraph2apx
from src.data.solvers.Acceptanc... | StarcoderdataPython |
4805441 | <gh_stars>0
#! /usr/bin/python
# Copyright (c) 2007-13 <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 restriction, including without limitation the rights
# to us... | StarcoderdataPython |
4805882 | import requests
class HttpApi(object):
"""A minimal wrapper around the LeanKitKanban HTTP API.
Methods take dictionaries for POST data, returns JSON
"""
def __init__(self, account_name, username, password, _service_base=None):
self.account_name = account_name
self.session = requests... | StarcoderdataPython |
1600723 | #!/usr/bin/env python3
from pyteal import *
# 45 parts out of 10000 from each swap goes to liquidity providers
# 5 parts out of 10000 from each swap goes to the developers
KEY_TOTAL_TOKEN1_BALANCE = Bytes("B1")
KEY_TOTAL_TOKEN2_BALANCE = Bytes("B2")
KEY_TOTAL_LIQUIDITY_TOKEN_DISTRIBUTED = Bytes("LD")
KEY_PROTOCOL_UN... | StarcoderdataPython |
1758309 | # Generated by Django 3.0.6 on 2020-06-04 09:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crudApp', '0006_auto_20200604_0903'),
]
operations = [
migrations.AlterField(
model_name='project',
name='project_bo... | StarcoderdataPython |
93803 | <reponame>LegenDarius116/pox<filename>run.py
import os
from argparse import ArgumentParser
def main():
"""Runs pox controller which points to h1,h2, and h3."""
ip = '10.0.1.1'
parser = ArgumentParser(description='Command line tool for quickly spinning up POX Controller')
parser.add_argument("-... | StarcoderdataPython |
1613747 | <reponame>molnarjani/data
from jsonschema import validate
import os
from pathlib import Path
import json
schema_companies = json.load(open('schema.json', encoding='utf-8'))
schema_authorities = json.load(open('schema-supervisory-authorities.json', encoding='utf-8'))
# see https://stackoverflow.com/a/10378012
pathlist... | StarcoderdataPython |
1607040 | from django.test import TestCase
from rest_framework.reverse import reverse
class MonstersTestCase(TestCase):
fixtures = [
'monsters.json',
'series.json',
]
def test_monster_list(self):
resp = self.client.get(reverse('api:v1:monster-list'))
self.assertEqual(resp.status_co... | StarcoderdataPython |
1720036 | frase = 'Curso em Vídeo Python'
#print(frase.upper().count('O'))
"""print('''xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx!''')"""
#print(len(frase.strip()))
#print(frase.replace('Python', 'Gay'))
#print('Curso' in frase)
#print(frase.find('Vídeo'))
#print(frase.lower().find('vídeo'))
"""dividido ... | StarcoderdataPython |
74512 | """
"""
from config import config
class Factory(object):
def __init__(self, session_name, **context):
self.context = context
self.session = sessions[session_name]()
self.factory = RepositoryFactory(self.session)
def __enter__(self):
self.session.__enter__()
return sel... | StarcoderdataPython |
3207994 | from typing import Dict, Callable, Union
import random
from ..calc.combat_data import AttackData
from ..calc import stats
def _(_: AttackData) -> None:
pass
def fe7_silencer(atk: AttackData) -> None:
"""
With a crit/2% chance to activate, deals damage equal to the opponent's remaining HP.
Prevents o... | StarcoderdataPython |
3319262 | <gh_stars>1-10
import torch
from torch.nn import Module
from cnns.nnlib.utils.general_utils import next_power2
from torch.nn.functional import pad as torch_pad
import numpy as np
from cnns.nnlib.utils.shift_DC_component import shift_DC
class FFTBandFunction2D(torch.autograd.Function):
"""
We can implement our... | StarcoderdataPython |
1787049 | <gh_stars>10-100
"""Serializers for the sequencers app."""
from rest_framework import serializers
from ..models import BarcodeSet, BarcodeSetEntry
class BarcodeSetEntrySerializer(serializers.ModelSerializer):
barcode_set = serializers.ReadOnlyField(source="barcode_set.sodar_uuid")
def update(self, instance... | StarcoderdataPython |
188188 | <filename>leetcode/python/1043_partition_array_for_maximum_sum.py
from typing import List
class Solution:
def maxSumAfterPartitioning(self, A: List[int], K: int) -> int:
N = len(A)
dp = [0] * N
for i in range(N):
j, left = i, max(0, i - K + 1)
curr_max = 0
... | StarcoderdataPython |
3252153 | <filename>src/tests/ftest/daos_test/daos_core_test_dfs.py
#!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import os
from daos_core_base import DaosCoreBase
class DaosCoreTestDfs(DaosCoreBase):
# pylint: disable=too-many-ancestors
"""Runs ... | StarcoderdataPython |
74543 | import click
from train_anomaly_detection import main_func
import numpy as np
import os
# Define base parameters.
dataset_name = 'selfsupervised'
net_name = 'StackConvNet'
xp_path_base = 'log'
data_path = 'data/full'
train_folder = 'train'
val_pos_folder = 'val/wangen_sun_3_pos'
val_neg_folder = 'val/wangen_sun_3_neg'... | StarcoderdataPython |
3297759 | #!/usr/bin/python2.4
#
#
# Copyright 2008, The Android Open Source Project
#
# 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 |
3250523 | <filename>maya/packages/oop_maya/core/maya_fbx.py<gh_stars>10-100
import maya.cmds as cmds
import maya.mel as mel
class FBX_Exporter():
def convert_to_joints( self ):
pass
def merge_mesh( self ):
pass
def export_mesh( self, file_path ):
file_path = file_path.replace( '\\', '/' )
mel.eval( "FBXPropert... | StarcoderdataPython |
1623850 | <filename>tests/test_flask.py
import sqlite3
import unittest
from flask import Flask
import pytest
from sqlalchemy import Column, Integer, String
from alchemical.flask import Alchemical
db = Alchemical()
class User(db.Model):
id = Column(Integer, primary_key=True)
name = Column(String(128))
class User1(db.... | StarcoderdataPython |
1703357 | from main.bike import testBike
from main.main_test import test
if __name__=="__main__":
test() | StarcoderdataPython |
1607858 | import os
import GenFiles
import pandas as pd
from collections import defaultdict
workdir = "/home/jana/Genotipi/Genotipi_DATA/Rjava_TEMP/"
os.chdir("/home/jana/Genotipi/Genotipi_DATA/Rjava_TEMP/")
os.system("ls -d Genotipi*/ > Dirs.txt")
dirs = list(pd.read_table("Dirs.txt", header=None).loc[:,0])
print(dirs)
chi... | StarcoderdataPython |
1765079 | <reponame>kssteven418/nums-1<gh_stars>0
# coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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 lim... | StarcoderdataPython |
1695284 | import json
import oandapyV20
import oandapyV20.endpoints.accounts as accounts
import oandapyV20.endpoints.instruments as instruments
import oandapyV20.endpoints.orders as orders
import oandapyV20.endpoints.positions as positions
import oandapyV20.endpoints.pricing as pricing
import oandapyV20.endpoints.trades as trad... | StarcoderdataPython |
3264198 | """
For each point cloud, generate a CSV that includes:
keep_ratio, class_id, true_positive, true_negative, false_positive, false_negative
Configurations
scannet_dir: root data folder of ScanNet
ply_dirname: folder of point cloud in PLY. [Ply_partial, Train_ply, Ply]
K: number o... | StarcoderdataPython |
115248 | <reponame>jorgedroguett/cajonera
# Cajones es una aplicacion que calcula el listado de partes
# de una cajonera
# unidad de medida en mm
# constantes
hol_lado = 13
# variables
h = 900
a = 600
prof_c = 400
h_c = 120
a_c = 200
hol_sup = 20
hol_inf = 10
hol_int = 40
hol_lateral = 2
esp_lado = 18... | StarcoderdataPython |
4808931 | import unittest
from datetime import datetime
from xbrr.edinet.client.document_list_client import MetaDataClient
from xbrr.edinet.client.document_list_client import DocumentListClient
from tests.utils import delay
class TestDocumentListClient(unittest.TestCase):
@delay
def test_metadata(self):
client... | StarcoderdataPython |
1786332 | from .decorator import *
from .process_cn_word import *
name="cn_sort" | StarcoderdataPython |
3329319 | <reponame>justHorsingAround/DevaintArt_bot
from bs4 import BeautifulSoup
import requests
import json
import os
def write_file(download, file_name):
with open(file_name, 'wb') as fd:
for chunk in download.iter_content(chunk_size=4096):
fd.write(chunk)
def write_log(user_name, download... | StarcoderdataPython |
1678380 | """Wrapper for sci-kit learn classifiers.
"""
import os
import joblib
import numpy as np
from wafamole.models import Model
from wafamole.exceptions.models_exceptions import (
NotPyTorchModelError,
PyTorchInternalError,
ModelNotLoadedError,
)
import torch
from wafamole.utils.check import type_check, file_exi... | StarcoderdataPython |
140029 | <filename>pandas_ta/volatility/rvi.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from pandas_ta.overlap import ma
from pandas_ta.statistics import stdev
from pandas_ta.utils import get_drift, get_offset
from pandas_ta.utils import unsigned_differences, verify_series
def rvi(close, high=None, low=None, length=None, scalar=... | StarcoderdataPython |
1630530 | import numpy as np
def mortality_lognormal(r, s):
'''Calculate mortality from cumulative log-normal distribution
Keyword arguments:
:param r: ratio of body burdens to cbr, summed (dimensionless)
:param s: dose-response slope (dimensionless)
:returns: mortality fraction (fraction)
'''
if r>... | StarcoderdataPython |
3264019 | #!/usr/bin/python
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
import pandas as pd
from . import autolabeling, formatting, utils
def evaluate(predictions, gt_path, lookup_path, count_analyzed, count_total, file_header='FileID'):
gt_df = utils.loa... | StarcoderdataPython |
4830808 | from gunicorn.http.errors import LimitRequestLine
request = LimitRequestLine
| StarcoderdataPython |
4834512 | import time
import board
from digitalio import DigitalInOut, Direction
"""
dir(board)
['A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'SCK', 'MOSI', 'MISO', 'D0', 'RX', 'D1', 'TX', 'SDA', 'SCL',
'D5', 'D6', 'D9', 'D10', 'D11', 'D12', 'D13', 'I2C', 'SPI', 'UART']
"""
LED = DigitalInOut(board.D13)
LED.direction = Directi... | StarcoderdataPython |
3204114 | #!/usr/bin/env python
# coding: utf-8
"""
unit tests for semiclassical propagators
"""
import unittest
import numpy as np
from numpy import fft
import scipy.linalg as sla
from scipy.interpolate import interp1d
import logging
# # Logging
logger = logging.getLogger(__name__)
logging.basicConfig(format="[testing] %(mess... | StarcoderdataPython |
1657669 | import adv.adv_test
from core.advbase import *
from slot.a import *
from slot.d import *
def module():
return Wedding_Elisanne
class Wedding_Elisanne(Adv):
comment = '2in1'
a1 = ('sp',0.08)
a3 = ('bc',0.13)
conf = {}
conf['acl'] = """
`s1,fsc and s2.charged<s2.sp-749
`s2
... | StarcoderdataPython |
3340139 | from facex import cartoonify, face_detection, blur_bg
import cv2
image = face_detection('face.jpg', method='opencv')
cv2.imshow("cartoon", image)
cv2.waitKey() | StarcoderdataPython |
1788645 | <filename>examples/shared_pandas.py
from os import getpid
from numpy.random import randn
from numpush.shmem import SDataFrame
from pandas import DataFrame
from multiprocessing import Process
N, M = 10, 10
df = DataFrame(randn(N,M))
sdf = SDataFrame(df)
assert df == sdf
assert df is not sdf
def modify(shared_df, st... | StarcoderdataPython |
68337 | <gh_stars>0
import yaml
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from project.models import Namespace, Project
class Command(BaseCommand):
help = 'Reload sync source config.'
def handle(self, *args, **options):
config_path = settings.TARGET_C... | StarcoderdataPython |
3299764 | <filename>users/tests.py
import json
from math import ceil
from random import randrange
from typing import List, Dict
from django.contrib.auth.models import AnonymousUser, User
from django.test import TestCase, Client
from django.urls import reverse
from django.utils.timezone import now
from utils.tests imp... | StarcoderdataPython |
197261 | from os import getcwd, stat, remove
import json
from pyinfraboxutils.token import encode_job_token
from pyinfraboxutils.storage import storage
from temp_tools import TestClient, TestUtils
from test_template import ApiTestTemplate
class JobApiTest(ApiTestTemplate):
url_ns = 'api/job'
def test_job(self):
... | StarcoderdataPython |
1760972 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 28 02:00:18 2019
@author: coby_
Practica 10: uso de librerias
"""
import datetime
hoy = datetime.date.today()
print(hoy)
print("El año es ", hoy.year)
print(hoy.weekday())
dias = datetime.timedelta(days=5)
hoy_mas_cinco = hoy + dias;
print(hoy_mas_cinco)
| StarcoderdataPython |
1725025 | <filename>scraping_utils/scraper.py
# Twitter Scraper for Hate Speech detection
import tweepy
import pandas as pd
import time
import configparser
# Folder Locations
OUTPUT_DIR = "data"
# Load Configs
config = configparser.ConfigParser()
config.read('config.ini')
consumer_key = config.get('dev', 'consumer_key')
consum... | StarcoderdataPython |
1730559 | import struct
import os
import time
import sys
import pymysql
from pypinyin import lazy_pinyin
from utils.tools import UtilLogger
from queue import Queue
from threading import Thread
# 建立一个线程池 用于存入解析完毕的数据
res_queue = Queue()
class ExtSougouScel():
"""
解析搜狗词库文件
"""
def __init__(self):
# 拼音表偏移... | StarcoderdataPython |
81327 | ''' Controller para fornecer dados da CEE '''
from flask_restful_swagger_2 import swagger
from flask import request
from resources.base import BaseResource
from model.municipio import Municipio
class MunicipiosResource(BaseResource):
''' Classe de múltiplos Municípios '''
CUSTOM_SWAGGER_PARAMS = [
{"na... | StarcoderdataPython |
3315883 | import pygtk
pygtk.require('2.0')
import gtk
import pango
print("Using pygtk " + str(gtk.pygtk_version))
print("Using gtk " + str(gtk.gtk_version))
from DesktopFileCreatorConfig import Info
from DesktopFileCreatorConfig import Config
from DesktopFileCreatorConfig import Categories
from DesktopFileCreatorState import ... | StarcoderdataPython |
102305 | #!/usr/bin/env python2.7
from itertools import groupby
from operator import itemgetter
import sys
from datetime import datetime
from math import *
#reader
def read_mapper_output(file, separator='\t'):
for line in file:
yield line.rstrip().split(separator, 1)
#discard trips with errors
def correctOutput(... | StarcoderdataPython |
3298295 | '''Module of common tool test class'''
import nose
import tempfile, shutil, os, itertools, re
def get_arg_flag(key):
return "--{}".format(re.sub('_', '-', key))
def make_args(outfile,**args):
'''Makes a list of argument strings from a dictionary for command line tools to process'''
arglist = ['{}={}... | StarcoderdataPython |
129175 | <gh_stars>0
#! python3
# isPhoneNumber.py - Program without regular expressions to find a phone number in text
def isPhoneNumber(text):
if len(text) != 12:
return False
for i in range(0,3):
if not text[i].isdecimal():
return False
if text[3] != '-':
return False
for ... | StarcoderdataPython |
1673945 | <reponame>Esukhia/text_utils
import os
import re
from collections import defaultdict
from PyTib.common import open_file, write_csv
def generate_prefixes(syls):
sequences = []
for i in range(len(syls) - 1): # -1 to not take the whole word
sub_sequence = '་'.join(syls[0:i + 1])
sequences.append... | StarcoderdataPython |
20517 | from unittest import TestCase
from unittest.mock import Mock, patch
from typeseam.app import (
load_initial_data,
)
class TestModels(TestCase):
@patch('typeseam.app.os.environ.get')
def test_load_initial_data(self, env_get):
ctx = Mock(return_value=Mock(
__exit__=Mock(),
... | StarcoderdataPython |
58996 | def f(t):
# relation between f and t
return value
def rxn1(C,t):
return np.array([f(t)*C0/v-f(t)*C[0]/v-k*C[0], f(t)*C[0]/v-f(t)*C[1]/v-k*C[1]])
| StarcoderdataPython |
1737758 | <reponame>rcap107/holoclean
from .constraintfeat import ConstraintFeaturizer
from .featurized_dataset import FeaturizedDataset
from .featurizer import Featurizer
from .freqfeat import FreqFeaturizer
from .initattrfeat import InitAttrFeaturizer
from .initsimfeat import InitSimFeaturizer
from .langmodelfeat import LangMo... | StarcoderdataPython |
1742851 | <reponame>vinthedark/snet-marketplace-service<gh_stars>0
import json
from common.constant import StatusCode
from dapp_user.exceptions import BadRequestException
from common.logger import get_logger
from common.utils import validate_dict_list, handle_exception_with_slack_notification, generate_lambda_response
from dapp... | StarcoderdataPython |
1660094 | <filename>vit_mutual/models/vision_transformers/deit.py
import torch
import torch.nn as nn
from .vit import ViT
class DeiT(ViT):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
embed_dim = self.transformer.embed_dim
self.dist_token = nn.Parameter(torch.zeros(1, 1, e... | StarcoderdataPython |
1752795 | import datetime
from django.db import models
from apps.accounts import models as accounts_models
from apps.commons import (
models as commons_models,
constants as commons_constants,
validators as commons_validators,
)
from apps.facility.models import Facility, TestingLab
from fernet_fields import EncryptedC... | StarcoderdataPython |
112945 | from model.group import Group
from fixture.additional import MH
import os.path
import getopt
import sys
import jsonpickle
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/groups.json"
for o, a ... | StarcoderdataPython |
1730089 | from subprocess import getoutput
from pathlib import Path
from transonic.util import timeit
statements = {
("cmorph", "_dilate"): "_dilate(image, selem, out, shift_x, shift_y)",
(
"_greyreconstruct",
"reconstruction_loop",
): "reconstruction_loop(ranks, prev, next_, strides, current_idx, i... | StarcoderdataPython |
1796832 | <gh_stars>1-10
from discord.ext import commands
from typing import Any
import discord
from datetime import datetime, timedelta, timezone
class MessageCount(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def count(self, ctx, channel: discord.TextChannel... | StarcoderdataPython |
3267039 | import unittest
import ipdb
import networkx as nx
import numpy as np
from fmge import fmge
import random
import matplotlib.pyplot as plt
class test_FMGE(unittest.TestCase):
graphs = []
@classmethod
def setUpClass(cls):
cls.graphs = cls._make_rand_graphs(n=100)
cls.fmge = fmge()
@cla... | StarcoderdataPython |
1666041 | <reponame>vyomshm/Auction
from django.dispatch import receiver
from django.db.models.signals import post_save, post_delete
from auction.bid.models import *
@receiver(post_save, sender=Bid)
def update_auction_1(sender, instance, created, **kwargs):
if created:
auction = instance.auction
auction.bid_count = Bid.Bid... | StarcoderdataPython |
3218459 | <gh_stars>0
def spam():
print(eggs) # ERROR!
eggs = 'spam local'
eggs = 'global'
spam() | StarcoderdataPython |
73363 | from collections import Counter
from pathlib import Path
from typing import List, Dict
def calculate_triangular_value(count: int) -> int:
result: int = 0
for i in range(count):
result += i
return result
class CrabCollection:
def __init__(self, initial_lineup: List[int]):
self.lineup ... | StarcoderdataPython |
1670087 | <filename>tests/test_sensfsp_solver.py<gh_stars>0
import unittest
import mpi4py.MPI as mpi
import numpy as np
import pypacmensl.sensitivity.multi_sinks as sensfsp
def tcoeff(t, out):
out[0] = 1
out[1] = 1
out[2] = 1
out[3] = 1
def dtcoeff(parameter, t, out):
if parameter == 0:
out[0] = 1.... | StarcoderdataPython |
1747388 | """Define the litcorpt data models"""
# pylint: disable=no-name-in-module
# pylint: disable=no-self-argument
# pylint: disable=no-self-use
# pylint: disable=too-few-public-methods
from enum import Enum
from typing import List, Optional
from datetime import date
from pydantic import BaseModel, ValidationError
# class... | StarcoderdataPython |
1792712 | <reponame>cschutijser/scion<filename>python/lib/packet/packet_base.py
# Copyright 2014 ETH Zurich
#
# 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-... | StarcoderdataPython |
3396763 | <filename>setup.py<gh_stars>0
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
NAME = 'weakCrypt'
DESCRIPTION = 'Fundamentally insecure crypto-explorations.'
URL = 'https://www.github.com/suddensleep/weakCrypt'
EMAIL = '<EMAIL>'
AUTHOR = '<NAME>'
REQUIRES_P... | StarcoderdataPython |
4811870 | <filename>code/tests/unit/conftest.py
from http import HTTPStatus
from unittest.mock import MagicMock
import jwt
from pytest import fixture
from app import app
from api.errors import INVALID_ARGUMENT
from tests.unit.payloads_for_tests import PRIVATE_KEY
@fixture(scope='session')
def client():
app.rsa_private_ke... | StarcoderdataPython |
1687169 | #Crie um Script Python que leia o nome de uma pessoa e mostre uma mensagem
#de boas vindas de acordo com o valor digitado
nome = input('Olá, digite seu nome: ')
print('Olá, ' +nome+ ' seja bem vindo!')
| StarcoderdataPython |
3205177 | # -*- coding: utf-8
""" Test the file recognizer capabilities.
"""
from __future__ import print_function, unicode_literals
import contextlib
import gzip
import os
import shutil
import socket
import sys
from io import open
from functools import partial
import nose
from grin import FileRecognizer, GZIP_MAGIC
pri... | StarcoderdataPython |
3245246 | i = open('sample.txt','r')
o = open('sample_output.txt','w')
a = i.read()
o.write(a)
| StarcoderdataPython |
37796 | <reponame>scottwedge/OpenStack-Stein<filename>murano-7.0.0/murano/policy/modify/actions/action_manager.py<gh_stars>10-100
# Copyright (c) 2015 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Lic... | StarcoderdataPython |
170370 | import requests
import kivy
kivy.require('1.9.2')
from kivy.app import App
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Label
api_key = 'get from wunderground.com'
class WU_GridLayout(BoxLayo... | StarcoderdataPython |
3327687 | <reponame>UnopposedQuill/muedatos2<gh_stars>0
from django.apps import AppConfig
class EvaluacionConfig(AppConfig):
name = 'Evaluacion'
| StarcoderdataPython |
129768 | <reponame>retresco/Spyder<filename>src/spyder/processor/stripsessions.py<gh_stars>10-100
#
# Copyright (c) 2011 <NAME> <EMAIL>
#
# stripsessions.py 14-Apr-2011
#
# 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 o... | StarcoderdataPython |
46469 | from .breadth_first_traversal import breadth_first_traversal
from .bst import BST
def test_breadth_first_traversal():
"""Test breadth-first traversal."""
tree = BST([2, 1, 3])
assert breadth_first_traversal(tree) == [2, 1, 3]
def test_breadth_first_traversal_balanced(balanced_bst):
"""Test breadth-f... | StarcoderdataPython |
3340703 | #!/usr/bin/python3
## author: <EMAIL>
## brief: find -kth node in uni-directional linked link
def inversely_kth(ll, k):
pass
import unittest
class SolutionTest(unittest.TestCase):
def test_basics(self):
self.assertInverselyKth([], 0, None)
self.assertInverselyKth([], 3, None)
self... | StarcoderdataPython |
1746553 | from django.template import Library
register = Library()
@register.inclusion_tag("tag_app/tag_list.html")
def show_tags_for(obj):
return {"obj": obj}
@register.inclusion_tag("tag_app/tag_count_list.html")
def show_tag_counts(tag_counts):
return {"tag_counts": tag_counts} | StarcoderdataPython |
3286720 | """
Contains logic of building GUI for the application.
"""
import os
from tkinter import Tk, ttk, messagebox
from tkinter.filedialog import askdirectory
from icon_apply import seticon
from icon_online_search import find_and_convert
class CreateGUI():
"""
Creates the GUI using tkinter module.
... | StarcoderdataPython |
30042 | from __future__ import print_function
import struct
import copy
#this class handles different protocol versions
class RobotStateRT(object):
@staticmethod
def unpack(buf):
rs = RobotStateRT()
(plen, ptype) = struct.unpack_from("!IB", buf)
if plen == 756:
return RobotStateRT_V... | StarcoderdataPython |
1780709 | <gh_stars>100-1000
import os
# Config
NODE_ID = int(os.getenv('NODE_ID'), '0')
MU_SUFFIX = os.getenv('MU_SUFFIX', 'zhaoj.in')
MU_REGEX = os.getenv('MU_REGEX', '%5m%id.%suffix')
SERVER_PUB_ADDR = os.getenv('SERVER_PUB_ADDR', '127.0.0.1')
API_INTERFACE = os.getenv('API_INTERFACE', 'modwebapi')
WEBAPI_URL = os.getenv(... | StarcoderdataPython |
1794977 | from .disc import enable
| StarcoderdataPython |
1626679 | import json
import numpy as np
class Turn:
def __init__(self, turn_id, transcript, turn_label, belief_state, system_acts, system_transcript, asr=None, num=None):
self.id = turn_id
self.transcript = transcript
self.turn_label = turn_label
self.belief_state = belief_state
self... | StarcoderdataPython |
4820179 | <reponame>c4dt/mlbench-core<filename>mlbench_core/optim/pytorch/__init__.py
from .optim import *
| StarcoderdataPython |
1710434 | <filename>mini_ipmi_smartctl.py
#!/usr/bin/env python3
## Installation instructions: https://github.com/nobodysu/zabbix-mini-IPMI ##
# Only one out of three system-specific setting is used, PATH considered.
binPath_LINUX = r'smartctl'
binPath_WIN = r'C:\Program Files\smartmontools\bin\smartctl.exe'
binPat... | StarcoderdataPython |
1760888 | <gh_stars>1-10
"""
Local templates for the plone PAS zopeskel project
"""
from zopeskel.localcommands import ZopeSkelLocalTemplate
class PlonePasSubTemplate(ZopeSkelLocalTemplate):
use_cheetah = True
marker_name = 'implemented plugins'
parent_templates = ['plone_pas']
class ExtractionPlugin(PlonePasSubTe... | StarcoderdataPython |
87010 | <reponame>Skaleras/Advent_of_Code<filename>day12/part1.py
# N stands for North
# S stands for south
# E stands for east
# W stands for west
#Oeste es West y Este es East
#NoSe == NWSE North and South are opposites, so are West and East
# N
# |
# W---+--E
# |
# ... | StarcoderdataPython |
1721249 | <filename>extractor/utils.py
# coding=utf-8
import os
import sys
import io
import gzip
import shutil
import base64
import traceback
import requests
from queue import Queue
from skimage import io
from bottle import HTTPResponse
from contextlib import closing
from concurrent.futures import ThreadPoolExecutor
class Temp... | StarcoderdataPython |
3342237 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# l... | StarcoderdataPython |
1619245 | <gh_stars>0
""" DB
This module implements an interface to the bank_server database.
"""
import json
import os.path
class Admin_DB(object):
"""Implements a Database interface for the bank server and admin interface"""
def __init__(self, db_path="admin_access.json"):
self.path = db_path
def close(... | StarcoderdataPython |
1609790 | # -*- coding:utf-8 -*-
"""
@author: leonardo
@created time: 2020-11-03
@last modified time:2020-11-03
"""
from sqlalchemy import create_engine,event
import numpy as np
def get_connection(database_name):
"""
:param database_name:
:return:
"""
return create_engine('mysql+pymysql://root:yangxh@192.16... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.