id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5011876 | <filename>pyvi/__config__.py
# -*- coding: utf-8 -*-
"""
Configuration script for pyvi package.
Notes
-----
Developed for Python 3.6
@author: <NAME> (<EMAIL>)
"""
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__version__ = "0.6"
__author_email__ = '<EMAIL>'
| StarcoderdataPython |
3200285 | import uuid
import pytest
from botx import ChatTypes
from botx.clients.methods.v3.chats.create import Create
from botx.concurrency import callable_to_coroutine
pytestmark = pytest.mark.asyncio
async def test_chat_creation(client, requests_client):
method = Create(
host="example.com",
name="<NAM... | StarcoderdataPython |
6560647 |
class Logger:
__instance = None
__logfile = None
@staticmethod
def get():
""" Static access method. """
if Logger.__instance == None:
Logger("log")
return Logger.__instance
def __init__(self, logfile):
""" Virtually private constructor. """
s... | StarcoderdataPython |
318614 | <filename>2020-codejam-01-qualification/e_indicium_experiment.py
import fileinput
# so basically it doesn't work like this :D, but it was a good coding practice
# we can build latin squares with all values on the trace without size+1 and size^2-1
def main():
cases_no = 0
matrix = [
[1, 2, 3],
... | StarcoderdataPython |
283127 | <reponame>CyberDAS-Dev/API
from sqlalchemy import (
Column,
ForeignKey,
Integer,
String,
Text,
DateTime
)
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from .__meta__ import Base
from cyberdas.utils.hash_type import HashType
class Session(Base):
'''
Объек... | StarcoderdataPython |
329101 | <gh_stars>0
"""
Autor: cienwfp
Data: 07/12/2021
"""
import os
import io
from flask import Flask, flash, request, send_file, Response
from flask_restful import Api
from flask_cors import CORS, cross_origin
from werkzeug.utils import secure_filename, safe_join
import ocrmypdf
import warnings
warnings.filterwarnings("ig... | StarcoderdataPython |
3507224 | <filename>torchdynamo/mutation_guard.py
import functools
import weakref
import torch.nn
from torch.nn import Module
from .utils import ExactWeakKeyDictionary
class MutationTracker:
db = ExactWeakKeyDictionary()
def __init__(self):
self.mutation_count = 0
self.watchers = []
def on_mutat... | StarcoderdataPython |
11253504 | from django.contrib.auth import get_user_model
class Developer:
"""
Designed for use within the Django shell to aid developers in performing
regular operations used for testing and debugging, primarily regarding
altering aspects of the developer's own User.
"""
def __init__(self, **user_l... | StarcoderdataPython |
6517038 | <filename>example/psutil/win32-compiled/psutil_example.py
"""
Psutil example with precompiled source code.
This example is for Windows platform only.
Some platform-dependent psutil submodules have been removed before dumping.
"""
import os
import paker
import logging
file = "psutil.json"
logging.basicConfig(level=log... | StarcoderdataPython |
11214986 | <filename>src/graph.py
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_edges_from(
[('A', 'B'), ('A', 'C'), ('D', 'B'), ('E', 'C'), ('E', 'F'),
('B', 'H'), ('B', 'G'), ('B', 'F'), ('C', 'G')])
pos = nx.spring_layout(G)
nx.draw_networkx_nodes(G, pos, cmap=plt.ge... | StarcoderdataPython |
9635839 | <filename>tests/data/deprecation-tests/workflows/deprecation_workflow.py
from leapp.workflows import Workflow
from leapp.workflows.phases import Phase
from leapp.workflows.flags import Flags
from leapp.workflows.tagfilters import TagFilter
from leapp.workflows.policies import Policies
from leapp.tags import Deprecation... | StarcoderdataPython |
11249596 | <reponame>ghassemiali/ghassemi9
from django.urls import path
from website.views import *
app_name = 'website'
urlpatterns = [
path('', home_view, name='home'),
path('about/', about_view, name='about'),
path('contact/', contact_view, name='contact'),
path('elements/', elements_view, name='elements'),
... | StarcoderdataPython |
9703523 | import asyncio
import aiohttp
import discord
import orjson
import simdjson
import uvloop
from discord.commands import Option, SlashCommandGroup
from discord.ext import commands
parser = simdjson.Parser()
class MCSrvStatsV1(commands.Cog):
def __init__(self, bot):
self.bot = bot
mc =... | StarcoderdataPython |
4947314 | """File with Card class tests."""
from war.card import Card
def testing_creation_instance() -> None:
card = Card(Card.Figure.As, Card.Color.Hearts)
str(card)
def testing_generating_id() -> None:
tested = Card(Card.Figure.As, Card.Color.Hearts).get_id()
expected = Card.Figure.As.value + 100 * Card.C... | StarcoderdataPython |
1782522 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2020 Baidu Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | StarcoderdataPython |
8140383 | from prometheus_client.core import GaugeMetricFamily
class FilesystemsSpaceMetrics():
"""
Base class for FlashBlade Prometheus filesystem space metrics
"""
def __init__(self, fb):
self.fb = fb
self.data_reduction = GaugeMetricFamily('purefb_filesystems_data_reduction',
... | StarcoderdataPython |
8191495 | <reponame>yanivbl6/convNet.pytorch
import torch
from torch.nn.parameter import Parameter
from torch.autograd import Variable, Function
import torch.nn as nn
import numpy as np
class masked_mean(Function):
@staticmethod
def forward(ctx, x, factor):
## x ~ [B ,C ,HW]
B = x.size(0)
HW = ... | StarcoderdataPython |
8074067 | import glob
from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='aws_azuread_login',
version='1.2',
author='<NAME>',
author_email='<EMAIL>',
description='Python 3.6+ library to enable programmatic Azure AD ... | StarcoderdataPython |
6665834 | <filename>des038.py
num1 = int(input('Primeiro numero : '))
num2 = int(input('Segundo numero : '))
if num1 > num2 :
print(' O primeiro numero , {} é maior que o segundo {} . '.format(num1,num2))
elif num1 < num2 :
print(' O primeiro numero , {} é menor que o segundo {} . '.format(num1,num2))
elif nu... | StarcoderdataPython |
4820958 | <reponame>chenzeyuczy/KDD2017<filename>code/load_data2.py
#! /usr/bin/env python
# Script to load data in phase 2.
import pandas as pd
from config import config
from load_data import parse_link_data, parse_route_data, parse_weather_data, parse_volume_data, \
parse_trajectory_data, parse_avg_time, parse_avg_volume, ge... | StarcoderdataPython |
5091470 | <reponame>common-workflow-lab/galaxy<gh_stars>0
#!/usr/bin/env python
import argparse
import json
import os
import sys
from bioblend import galaxy
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "lib")))
from galaxy.tool_util.cwl.runnable import get_outputs
from galaxy.version ... | StarcoderdataPython |
12813 | <reponame>stillmatic/mizani<filename>mizani/breaks.py
"""
All scales have a means by which the values that are mapped
onto the scale are interpreted. Numeric digital scales put
out numbers for direct interpretation, but most scales
cannot do this. What they offer is named markers/ticks that
aid in assessing the values ... | StarcoderdataPython |
4821736 | <filename>asv_bench/benchmarks/benchmarks_get_bitinformation.py<gh_stars>0
import numpy as np
import xarray as xr
from xbitinfo import get_bitinformation
from . import (
_skip_julia,
_skip_slow,
ensure_loaded,
parameterized,
randn,
requires_dask,
)
class Base:
"""
Benchmark time and ... | StarcoderdataPython |
11308321 | # Copyright 2019 PIQuIL - 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 applicable law or agreed ... | StarcoderdataPython |
96744 | # Copyright (c) 2021 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import itertools
import unittest
from typing import List
from ai.test_utils import card_list_from_string
from ai.utils import card_win_probabilities, prob_opp_has_... | StarcoderdataPython |
6642348 | """
test read spec
"""
import os
from gpy_dla_detection.read_spec import read_spec, retrieve_raw_spec
import numpy as np
def test_read_spec():
if not os.path.exists("spec-7340-56825-0576.fits"):
retrieve_raw_spec(7340, 56825, 576) # an arbitrary spectrum
wavelengths, flux, noise_variance, pixel_mask... | StarcoderdataPython |
276743 | <filename>transform/transformers/cora/__init__.py
from .ukis_transformer import UKISTransformer
__all__ = ['UKISTransformer']
| StarcoderdataPython |
314354 | <reponame>onethinglab/SyncSlot<gh_stars>0
#!/usr/bin/env python3
import os
from pathlib import Path
from shutil import rmtree
from shutil import copytree
__CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
INSTALLED_PACKAGES = str(Path(__CURRENT_PATH + "/../node_modules").resolve()) + os.sep
CLIENT_INSTALLED... | StarcoderdataPython |
50503 | <reponame>kmad1729/python_notes
class MyArray:
def __init__(self, *args):
self.elems = list(args)
def __repr__(self):
return str(self.elems)
def __getitem__(self, index):
return self.elems[index]
def __setitem__(self, index, value):
self.elems[index] = value
def _... | StarcoderdataPython |
5113447 | <gh_stars>1-10
input_integer = int(input("Enter the number : "))
factor = 1
if input_integer < 0:
factor = -1
input_integer *= factor
reversed_integer = 0
while input_integer != 0:
reversed_integer = reversed_integer*10 + input_integer%10
input_integer //= 10
reversed_integer *= factor
print(reversed_intege... | StarcoderdataPython |
1622586 | #!/usr/bin/python3
from src import storage_connection as sc
import numpy as np
"""
Last edited by : Shawn
Last edited time : 29/11/2021
Version Status: dev
TO DO:
The functions in this file are for reading and preparing the inputs for the NN.
Required: Path to NN_input.txt
Path to vector.csv
"""
def get_... | StarcoderdataPython |
31325 | #!/usr/bin/env python
# encoding: utf8
#
# Copyright © <NAME> <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#... | StarcoderdataPython |
5063773 | """
Confusion matrix script for
binaural localization neural
net.
Author: <NAME>
Reference: http://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py
"""
import matplotlib.pyplot as plt
import numpy as np
import itertools
i... | StarcoderdataPython |
11381493 | <filename>slack_bolt/async_app.py
from .app.async_app import AsyncApp # noqa
from .context.ack.async_ack import AsyncAck # noqa
from .context.async_context import AsyncBoltContext # noqa
from .context.respond.async_respond import AsyncRespond # noqa
from .context.say.async_say import AsyncSay # noqa
from .listener... | StarcoderdataPython |
3348162 | <filename>muDIC/vlab/downsampler.py
# -*- coding: utf-8 -*-
""" Down sampling module which can be used to downsample images by interpolation,
include sensor artifacts such as fillfactor and pixel location inaccuracies.
This module is directly based on the conference paper:
>>> <NAME>, <NAME>, <NAME>, <NAME>. A speckl... | StarcoderdataPython |
3352114 | <filename>tweet_harvester_main.py<gh_stars>0
print("Importing Libraries")
from sqlalchemy import create_engine
import tweepy as tweepy
import pandas as pd
print("Importing Packages")
import tweet_functions as tf
from credentials import *
print("Connecting to Database")
db_connection_string = "mysql+pymysql://{}:{... | StarcoderdataPython |
3305329 | <gh_stars>1-10
#!/usr/bin/env python
import os
import six
try:
import unittest2 as unittest
except ImportError:
import unittest
from csvkit.utilities.csvclean import CSVClean
class TestCSVClean(unittest.TestCase):
def test_simple(self):
args = ['examples/bad.csv']
output_file = six.Stri... | StarcoderdataPython |
3526403 | <gh_stars>0
class Joe(object):
def callme(self):
print('calling "callme" method with instance: ')
print(self)
thisjoe = Joe()
thisjoe.callme()
print(thisjoe)
myint = 5
mystr = 'hello'
print(type(myint))
print((type(mystr)))
class MyClass(object):
pass
this_object = MyClass()
print("thi... | StarcoderdataPython |
37907 | """
EGF string variables for testing.
"""
# POINT
valid_pt = """PT
Park Name, City, Pond, Fountain
Post office Square, Boston, FALSE, TRUE
42.356243, -71.055631, 2.0
Boston Common, Boston, TRUE, TRUE
42.355465, -71.066412, 10.0
"""
invalid_pt_geom = """PTs
Park Name, City, Pond, Fountain
Post office S... | StarcoderdataPython |
9071 | """
@author: tyrantlucifer
@contact: <EMAIL>
@blog: https://tyrantlucifer.com
@file: main.py
@time: 2021/2/18 21:36
@desc: shadowsocksr-cli入口函数
"""
import argparse
import traceback
from shadowsocksr_cli.functions import *
def get_parser():
parser = argparse.ArgumentParser(description=color.blue("The shadowsocks... | StarcoderdataPython |
8038253 | from nonebot import on_command, get_driver
from nonebot.adapters.cqhttp.bot import Bot
import nonebot
import asyncio
'''
广播test
'''
ban_group = nonebot.get_driver().config
async def broadcast(bot: Bot, msg, this_group = None):
list = await bot.get_group_list(self_id=bot.self_id)
for item in list:
gro... | StarcoderdataPython |
8090166 | # Generated by Django 2.2.4 on 2019-08-22 17:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0047_auto_20190821_2145'),
]
operations = [
migrations.AddField(
model_name='... | StarcoderdataPython |
320137 | <reponame>TahaEntezari/ramstk
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.controllers.preferences.preferences_unit_test.py is part of The RAMSTK
# Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class ... | StarcoderdataPython |
6580616 | <reponame>ganlvtech/wsgi-example<filename>golang/__init__.py
import os
import subprocess
import portpicker
GO_SERVER_PORT = None
def get_go_program_path():
if os.name == 'nt':
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'go/bin/main.exe')
elif os.name == 'posix':
path = o... | StarcoderdataPython |
3532825 | <reponame>ulgot/kidomat
import sys
import random
import string
def get_variables(n=1, level=1):
'''
Generate variables for equation.
Parameters
----------
n : int or dict or list or tuple
number of variables or equations to solve
level : int
difficulty of problem to solve
... | StarcoderdataPython |
4811106 | from leapp import config
def get_config():
if not config._LEAPP_CONFIG:
config._CONFIG_DEFAULTS['repositories'] = {'repo_path': '/etc/leapp/repos.d'}
return config.get_config()
| StarcoderdataPython |
1851399 | '''
Created on Mar 4, 2020
@author: ballance
'''
class ArrayFieldModel():
def __init__(self,
name):
pass
| StarcoderdataPython |
3386503 | from ns.utils import stampedstore
class VirtualClockServer:
""" Models a virtual clock server. For theory and implementation see:
<NAME>, Virtual clock: A new traffic control algorithm for packet switching networks,
in ACM SIGCOMM Computer Communication Review, 1990, vol. 20, pp. 19.
Para... | StarcoderdataPython |
1972638 | from django.db.models import Q
from rest_framework import viewsets
from plugs_core.permissions import IsOwnerOrReadOnly
from plugs_configuration.models import Configuration
from plugs_configuration import serializers
class ConfigurationViewSet(viewsets.ModelViewSet):
"""
Configuration Viewset
"""
qu... | StarcoderdataPython |
1958957 | <filename>repository/migrations/0001_initial.py
# Generated by Django 2.0.5 on 2018-09-25 13:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
9629526 | <reponame>alxlhr/FLUOR<filename>IO.py
import netCDF4 as nc
import numpy as np
import os.path as path
import os
def save(state, params) :
if state.speed_rand == 1 or state.speed_mean == 1:
dir = '/media/alexandre/DATA/Stage_M2/exp/arrivals/dist_z/2D_arr/'
else :
#dir = '/media/alexandre/DATA/Sta... | StarcoderdataPython |
3301315 | <reponame>elexira/deep-reinforcement-learning
# main function that sets up environments
# perform training loop
import envs
from buffer import ReplayBuffer
from maddpg import MADDPG
import torch
import numpy as np
from tensorboardX import SummaryWriter
import os
from utilities import transpose_list, transpose_to_tenso... | StarcoderdataPython |
125856 | <reponame>SpellcheckerExtraordinaire/PrisonersDilemmaTournament
#
# AGENT
# Sanjin
#
# STRATEGY
# This agent always defects, if the opponent defected too often. Otherwise it cooperates.
#
def getGameLength(history):
return history.shape[1]
def getChoice(snitch):
return "tell truth" if snitch else "stay silen... | StarcoderdataPython |
3364162 | <gh_stars>1-10
from datetime import timedelta
from typing import Any
from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session
from app.api import deps
from app.core import security
from app.core.config import settings
from app.sche... | StarcoderdataPython |
3241543 | #---------------------------------------------------------------------------
# manager.py
#
# Author : <NAME>
# Date : July 10, 2015
# School : Harvard University
#
# Project : Master Thesis
# An Interactive Deep Learning Toolkit for
# Automatic Segmentation of Images
#
# Summary : This file co... | StarcoderdataPython |
8033969 | <reponame>botcs/dsp-lr
# Base code: PyTorch models in torchvision
# Original source: https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
... | StarcoderdataPython |
12801022 | <gh_stars>10-100
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
class New1(nn.Module):
def __init__(self, in_ch, out_ch):
super(New1, self).__init__()
self.mask = torch.from_numpy(np.array([[1,1,1],[1,0,1],[1,1,1]], dtype=np.float32)).cuda()
se... | StarcoderdataPython |
18161 | <filename>RecamanSequence/recaman_sequence.py
import sys
from itertools import count, islice
def sequence():
"""Generate Recaman's sequence"""
seen = set()
a = 0
for n in count(1):
yield a
seen.add(a)
c = a - n
if c < 0 or c in seen:
c = a + n
a = c
... | StarcoderdataPython |
6524344 | <reponame>eberjoe/tradocs<gh_stars>0
import requests
import os
import shutil
import re
import codecs
import time
import datetime
import click
import json
from git import Repo
from colorama import init
from pathlib import Path
targetPaths = []
stats = []
cont = ''
greenFlag = False
processed = False
reqs = 0
chars = 0... | StarcoderdataPython |
3363591 | from typing import Union
from typing import List
from enum import Enum
from ibc.session import InteractiveBrokersSession
class MarketData():
def __init__(self, ib_client, ib_session: InteractiveBrokersSession) -> None:
"""Initializes the `MarketData` client.
### Parameters
----
i... | StarcoderdataPython |
1731823 | <reponame>squadran2003/battleship
from ship import Ship
from grid import Grid
class Board(Grid,Ship):
board_input = ""
board_errors = []
# will be a list of coordinates
occupied_spots = []
# list of dicts. each dict will have a coord and its corresponding ship name
ships_on_board = []
x = ... | StarcoderdataPython |
5003675 | from enum import Enum
class AudioFormat(Enum):
MP3 = 1
OGGOPUS = 2
OGGVORBIS = 3
class UnsupportedAudioFormat(Exception):
def __init__(self, message):
self._message = message | StarcoderdataPython |
367057 | import sys
import os
from os import listdir
files = listdir(sys.argv[1])
os.chdir(sys.argv[1])
for f in files:
if ".svg" in f:
thisOne = open("./" + f, "r")
currentText = thisOne.read()
name = f.replace(".svg", "").replace("_", "").capitalize()
thisOne.close()
newText = "import Svg, {Path} fr... | StarcoderdataPython |
9669940 | from flask import request, jsonify
from flask_cors import cross_origin
from app import app
from app.Slackov import Slackov
slackov = Slackov()
@app.route("/")
def hello():
return "Welcome to slackov"
@app.route("/generate/user", methods=['POST'])
@cross_origin()
def generate_user():
params = get_request_p... | StarcoderdataPython |
361554 | """Keep state for users
- pn.state.cache persists state across all sessions as long as the server is
running
- pn.state.cookies persists state for a given session
Try to persist state for a given user across sessions so that information is not
lost by a simple reload.
"""
# Third party imports
import panel as pn
... | StarcoderdataPython |
12847532 | model.compile(
optimizer='rmsprop',
loss='binary_crossentropy',
metrics=['acc']
)
history = model.fit(
x_train,
y_train,
epochs=10,
batch_size=32,
validation_data=(x_val, y_val)
)
model.save_weights('pre_trained_glove_model.h5')
| StarcoderdataPython |
4853490 | import discord
from discord.ext import commands
import youtube_dl
import os
from discord.ext import commands, tasks
from random import choice
client = commands.Bot(command_prefix="?")
@client.command()
async def join(ctx):
if not ctx.message.author.voice:
await ctx.send("❗❓You are not connected to a vo... | StarcoderdataPython |
6548595 | <reponame>TnTo/cdlib<gh_stars>0
import collections
import numpy as np
import networkx as nx
from sklearn.cluster import DBSCAN
class WalkSCAN(object):
def __init__(self, nb_steps=2, eps=0.1, min_samples=3):
self.nb_steps = nb_steps
self.eps = eps
self.min_samples = min_samples
sel... | StarcoderdataPython |
351199 | from sage.graphs.trees import TreeIterator
### HELPERS ###
def count_trees(trees):
'''
input: an iterator containing trees.
output: the size of the iterator.
'''
count = 0
for t in trees:
count += 1
return count
def count_leaves(trees):
'''
input: an iterator containing t... | StarcoderdataPython |
1950686 |
import FWCore.ParameterSet.Config as cms
# Turn of MC dependence in pat sequence
def removePatMCMatch(process):
process.prod.remove(process.genPartons)
process.prod.remove(process.heavyIonCleanedGenJets)
process.prod.remove(process.hiPartons)
process.prod.remove(process.patJetGenJetMatch)
process.... | StarcoderdataPython |
9741169 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Valiant Systems and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import add_days, cint, cstr, flt, getdate, ... | StarcoderdataPython |
8176142 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 06 14:25:40 2017
@author: <NAME>
"""
from __future__ import division
from __future__ import unicode_literals
import os
import time
import csv
import numpy as np
import tensorflow as tf
import deepchem
import pickle
from deepchem.molnet.run_benchmark_models import benchmar... | StarcoderdataPython |
9783072 | <gh_stars>1-10
import unittest
import os
import datetime
from infra.builder import Builder
from infra.emulator import Emulator
BASIC_TOOLCHAIN_CONFIG = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://... | StarcoderdataPython |
198152 | import torch
def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int):
"""
Shift input ids one token to the right.
"""
shifted_input_ids = input_ids.new_zeros(input_ids.shape)
shifted_input_ids[:, 1:] = input_ids[:, :-1].clone()
shifted_input_ids[:, 0] = de... | StarcoderdataPython |
136320 | <gh_stars>0
from typing import Any, Tuple
from neuraxle.base import BaseTransformer
from neuraxle.base import ExecutionContext as CX
from neuraxle.data_container import DataContainer as DACT
from neuraxle.hyperparams.space import (HyperparameterSamples,
HyperparameterSpace)
from... | StarcoderdataPython |
8045147 | #!/usr/bin/env python
import os
import sys
from pathlib import Path
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app")
BASE_DIR = Path(__file__).parent
ALLOWED_HOSTS = ['*']
DEBUG = True
ROOT_URLCONF = 'app'
SECRET_KEY = 'supersecret'
LANGUAGES = []
STATIC_URL = '/static/'
WSGI_APPLICATION = 'app.application'
INST... | StarcoderdataPython |
11347568 | # This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Test uploading and downloading full direc... | StarcoderdataPython |
4871752 | class BaseScriptObject:
module = None # cant use hints due to import recursion. ..module.ScriptModue
def Load(self, name, data):
pass
def getModule(self):
return self.module
| StarcoderdataPython |
1953118 | <gh_stars>0
# Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
import uuid
from front.lib import db, gametime, get_uuid, email_ses
import logging
logger = logging.getLogger(__name__)
def enqueue_email_message(ctx, email_message):
"""
Request that a given EmailMessage be added to the email ... | StarcoderdataPython |
3471031 | """Custom exceptions."""
class HalflingError(Exception):
"""Encapsulates exceptions risen by halfling."""
class HalflingCompileError(HalflingError):
"""Encapsulates compile errors."""
class HalflingLinkError(HalflingError):
"""Encapsulates link errors."""
| StarcoderdataPython |
11209575 | <filename>07-programasDeAlgoritmo/1-programaDeAlgoritmoTipo1/0versoesAntigas/4-programa/programa.py
from time import sleep
from random import shuffle
from os import system
f = '\33[m'
bgBlue = '\033[44m' # backgournd blue
bgYellow = '\033[43m' #backgournd yellow
bgRed = '\033[41m' #backgournd red
# definição do tama... | StarcoderdataPython |
4853838 | <filename>apps/1d/burgers/sine_to_n/params_template.py
finess_data_template = '''
; Parameters common to FINESS applications
[finess]
ndims = 1 ; 1, 2, or 3
nout = 1 ; number of output times to print results
tfinal = 1.591549430918953e-01 ; final time
initial_dt = 1.00e-03 ; in... | StarcoderdataPython |
9717618 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 3/16/2018 9:51 AM
# @Author : sunyonghai
# @File : data_processing_.py
# @Software: ZJ_AI
# =========================================================
import os
import xml.etree.ElementTree as ET
import numpy as np
import cv2
import io_utils
#此函数用来复制annotati... | StarcoderdataPython |
358448 | # try:
# import os
# import sys
# import math
# import random
# import time
# import pickle
# import json
# import requests
# import numpy as np
# import pandas as pd
# import scipy as sp
# import seaborn as sns
# import matplotlib.pyplot as plt
# import sympy
# e... | StarcoderdataPython |
11259901 | <reponame>nickpack/reportlab<filename>src/reportlab/graphics/charts/axes.py
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
__version__=''' $Id: axes.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""Collection of axes for charts.
The current collection comprises axes for charts ... | StarcoderdataPython |
1818392 | <reponame>alturus/fox_hunting<filename>fox_hunting.py<gh_stars>0
import os
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
from flask_session import Session
from app import create_app, db
from app.models import F... | StarcoderdataPython |
4834046 | import asyncio
from typing import Optional, NoReturn
from aiofcm.connection import FCMConnectionPool
from aiofcm.common import Message, MessageResponse
from aiofcm.logging import logger
class FCM:
def __init__(self, sender_id, api_key, max_connections=10, loop=None):
# type: (int, str, int, Optional[asyn... | StarcoderdataPython |
1870766 | # -*-coding:Utf-8 -*
from mplotlab.utils.abctypes import RegisterType,STRING
from abcmodels import AModel
from numpy import *
class AVariable(AModel):
def getData(self):
return []
class Variable(AVariable):
parametersInfo = list(AVariable.parametersInfo)
parametersInfo.extend([
... | StarcoderdataPython |
3383335 | # from flask import Flask
# from flask_mail import Mail
# import smtplib
# import email.utils
# from email.mime.text import MIMEText
# app = Flask(__name__)
# mail = Mail(app)
# from flask_mail import Message
# @app.route("/")
# def index():
# msg = Message("Hello",
# sender="<EMAIL>",
# ... | StarcoderdataPython |
3527872 | __author__ = '<NAME>'
import streamlit as st
import pandas as pd
def second_app():
st.title('Second Application')
st.header('Names Information')
st.subheader('Family Names')
df = pd.DataFrame({'Family Names': ['Venkat', 'Nageshwaramma', 'Krishna', 'Manishree']})
st.write('Family Members are', df)
if ... | StarcoderdataPython |
8031818 | <reponame>Searchlight2/Searchlight2<gh_stars>10-100
from statistical_analysis_tools.differential_expression_signature.get_meta_gene import get_meta_gene
from statistical_analysis_tools.differential_expression_signature.spearman_correlation import spearman_correlation
def merge_signatures(genes_by_signature, mde_dict, ... | StarcoderdataPython |
9777203 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2001-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... | StarcoderdataPython |
8101808 | # -*- coding: utf-8 -*-
"""
Volunteer Management System
@author: <NAME>
@author: nursix
"""
module = "vol"
if deployment_settings.has_module(module):
# Settings
resource = "setting"
tablename = module + "_" + resource
table = db.define_table(tablename,
Field("audit_re... | StarcoderdataPython |
3208541 | <reponame>frkl-io/bring
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `bring` package."""
import pytest # noqa
import bring
def test_assert():
assert bring.__version__ is not None
| StarcoderdataPython |
1816227 | some.int
some.sum
some.super
some.unicode
some.foo
some.Exception
some : source.python
. : source.python
int : source.python
some : source.python
. : source.python
sum : source.python
some : source.python
. : source.python
super ... | StarcoderdataPython |
6546127 | class Cliente:
def __init__(self, nome=None, cpf=None, email=None, endereco=None, fone=None, bairro=None, categoria=None):
self.nome = nome
self.cpf = cpf
self.email = email
self.endereco = endereco
self.fone = fone
self.bairro = bairro
self.categoria = categoria
self.erro_validacao = ... | StarcoderdataPython |
9671371 | <reponame>nomad-coe/electronic-parsers
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# 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... | StarcoderdataPython |
3519265 |
import smart_imports
smart_imports.all()
class REPORT_STATE(enum.Enum):
PROCESSING = 1
READY = 2
NOT_EXISTS = 3
@dataclasses.dataclass(frozen=True)
class Report:
__slots__ = ('data', 'state', 'completed_at', 'expire_at')
data: dict
state: REPORT_STATE
completed_at: datetime.datetime
... | StarcoderdataPython |
1642470 | # -*- coding: utf-8 -*-
"""
Zenoss jobs_router
"""
from zenossapi.routers import ZenossRouter
class JobsRouter(ZenossRouter):
"""
Class for interacting with the Zenoss device router
"""
def __init__(self, url, headers, ssl_verify):
super(JobsRouter, self).__init__(url, headers, ssl_verify, ... | StarcoderdataPython |
12864752 | <reponame>muthash/Weconnect-api
""" The create_app function wraps the creation of a new Flask object, and
returns it after it's loaded up with configuration settings
using app.config
"""
from flask import jsonify
from flask_api import FlaskAPI
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.