id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
119793 | from typing import List
import datasets
# Citation, taken from https://github.com/microsoft/CodeXGLUE
_DEFAULT_CITATION = """@article{CodeXGLUE,
title={CodeXGLUE: A Benchmark Dataset and Open Challenge for Code Intelligence},
year={2020},}"""
class Child:
_DESCRIPTION = None
_FEATURES = N... | StarcoderdataPython |
298654 | #! /usr/bin/env python
from .triplet import TripletLoss, HardTripletLoss, FullTripletLoss
from .cross_entropy import LabelSmoothCrossEntropyLoss
| StarcoderdataPython |
4970597 | <filename>RecoLuminosity/LumiDB/python/lumiQTWidget.py<gh_stars>1-10
import sys,os
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from PyQt4 import QtGui, QtCore
class LumiCanvas(FigureCanvas):
"""this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
def __init__(sel... | StarcoderdataPython |
230233 | <filename>server/config.py
import os
DEBUG = False
TOKEN_SECRET = os.environ.get('SECRET_KEY') or 'JWT_SECRET'
MYSQL_DATABASE_USER = os.environ.get('MYSQL_DATABASE_USER') or 'user'
MYSQL_DATABASE_PASSWORD = os.environ.get('MYSQL_DATABASE_PASSWORD') or 'password'
MYSQL_DATABASE_DB = os.environ.get('MYSQL_DATABASE_DB') ... | StarcoderdataPython |
1898067 | #!/usr/bin/env python
import sys
from . import parser, printer, rewriter
#----------------------------------------------------------------------------------------------------------------------
if __name__ == "__main__":
# process cmd-line switches
f = open(sys.argv[-1], "r")
s = f.read()
f.close()
# pars... | StarcoderdataPython |
6602893 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from transform_finder import build_transform
import torch
import torchvision as tv
from utils.converters import PilToNumpy, NumpyToTensor
CIF... | StarcoderdataPython |
5111888 | """
API support for endpoints located at API_ROOT/poe
"""
from .utils import urlforversion
class POEMixin(object):
__doc__ = __doc__
def poe_confirm(self, email, transaction_id, confirmation_token, result):
"""Allows confirmation of client side verification (javscript widget)
Arguments:
... | StarcoderdataPython |
8039489 | #!/usr/bin/env python3
"""
https://www.reddit.com/r/dailyprogrammer/comments/3r7wxz/20151102_challenge_239_easy_a_game_of_threes/
Given a starting number, play the game of threes, printing your steps.
For every number, add 0, 1, or -1 to make it divisble by 3, then divide by 3.
Continue until you reach 1.
"""
def ga... | StarcoderdataPython |
6596227 | <reponame>jakeogh/anormbookmarker
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MIT License
class ConflictingAliasError(ValueError):
'''
An Alias cant be created because it conflicts with a existing Alias to a different Word.
'''
pass
class ConflictingWordMisSpellingError(ValueError):
'''
A... | StarcoderdataPython |
9661912 | <gh_stars>0
from wowstash.library.jsonrpc import wallet
from wowstash.models import Transaction
from wowstash.factory import db
# @app.errorhandler(404)
def not_found(error):
return make_response(jsonify({
'error': 'Page not found'
}), 404)
# @app.cli.command('initdb')
def init_db():
db.create_al... | StarcoderdataPython |
3352999 | """
basic.py
A basic calculator.
"""
from calc.keyboard import Keyboard
from calc.screen import Screen
from calc.memory import Memory
from calc.handler import Handler
class BasicCalculator():
vendor = "Python"
model = "basic"
# BasicCalculator HAS A Keyboard
keyboard = Keyboard()
# BasicCalc... | StarcoderdataPython |
8061440 | <reponame>dgaston/ddbio-ngsflow
"""
.. module:: gatk
:platform: Unix, OSX
:synopsis: A wrapper module for calling GATK utilities.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import pipeline
def diagnosetargets(job, config, name, samples, input_bam):
"""Run GATK's DiagnoseTargets against the supplied region
... | StarcoderdataPython |
1929286 | import os
import numpy as np
import math
from GPy.util import datasets as dat
class vertex:
def __init__(self, name, id, parents=[], children=[], meta = {}):
self.name = name
self.id = id
self.parents = parents
self.children = children
self.meta = meta
def __str__(self)... | StarcoderdataPython |
1820069 | import pygame
import neat
import time
import os
import random
pygame.font.init()
GEN = 0
WIN_WIDTH = 500
WIN_HEIGHT = 800
# load images and makes them 2 times bigger using scale2x
BIRD_IMGS = [pygame.transform.scale2x(pygame.image.load(os.path.join('imgs', 'bird1.png'))),
pygame.transform.scale2x(pygame.... | StarcoderdataPython |
1621189 | <reponame>timsque/deep-histopath
# ------------------------------------------------------------------------
#
# 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/lice... | StarcoderdataPython |
8128162 | from os import system
f_op=('1. evaluation', '2. gradiens', '3. tangent plane', '4. integral', '5. linear integral', '6. surface integral', '7. indefinite integral', '8. limit', '9. Taylor series', '10. max or min', '11. plot', '0. exit')
F_op=('1. evaluation', '2. divergence', '3. curl', '4. path integral', '5. flux i... | StarcoderdataPython |
1675990 | import argparse
import sys
import os
import traceback
from biokbase.CompressionBasedDistance.Client import _read_inifile, ServerError as CBDServerError
from biokbase.CompressionBasedDistance.Helpers import get_config, parse_input_file, start_job
desc1 = '''
NAME
cbd-buildmatrixlocal -- build a distance matrix to... | StarcoderdataPython |
36373 | <reponame>nw13slx/thyme
import logging
import numpy as np
from glob import glob
from os.path import getmtime, isfile
from os import remove
from thyme import Trajectory
from thyme.parsers.monty import read_pattern, read_table_pattern
from thyme.routines.folders import find_folders, find_folders_matching
from thyme._ke... | StarcoderdataPython |
3477511 | <filename>roses/rosebiology/apps.py
from django.apps import AppConfig
class RosebiologyConfig(AppConfig):
name = 'rosebiology'
| StarcoderdataPython |
38123 | <filename>snaps/openstack/tests/create_user_tests.py<gh_stars>0
# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
# and others. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | StarcoderdataPython |
1996208 | from marshmallow import fields
from .exceptions import UnsupportedValueError
def handle_length(schema, field, validator, parent_schema):
"""Adds validation logic for ``marshmallow.validate.Length``, setting the
values appropriately for ``fields.List``, ``fields.Nested``, and
``fields.String``.
Args:... | StarcoderdataPython |
9600090 | # -*- coding: utf-8 -*-
from ..errors import JsonRpcBatchSizeError
from ..errors import handle_middleware_exceptions
from ..request import JussiJSONRPCRequest
from ..typedefs import HTTPRequest
from ..validators import limit_broadcast_transaction_request
@handle_middleware_exceptions
async def check_limits(request: H... | StarcoderdataPython |
4911254 | <reponame>pombredanne/ruffus<filename>ruffus/test/test_follows_mkdir.py
#!/usr/bin/env python
from __future__ import print_function
import unittest
from ruffus import follows, pipeline_run, Pipeline, mkdir
import sys
"""
test_follows_mkdir.py
"""
import os
tempdir = os.path.relpath(os.path.abspath(os.path.splite... | StarcoderdataPython |
381728 | <reponame>mayi140611/mayiutils_n1<gh_stars>0
#!/usr/bin/python
# encoding: utf-8
"""
@author: Ian
@file: read_config_file.py
@time: 2019-08-06 13:41
"""
def read_config_file(fp: str, mode='r', encoding='utf8', prefix='#') -> dict:
"""
่ฏปๅๆๆฌๆไปถ๏ผๅฟฝ็ฅ็ฉบ่ก๏ผๅฟฝ็ฅprefixๅผๅคด็่ก๏ผ่ฟๅๅญๅ
ธ
:param fp: ้
็ฝฎๆไปถ่ทฏๅพ
:param mode:
:... | StarcoderdataPython |
45263 | class FormClosedEventArgs(EventArgs):
"""
Provides data for the System.Windows.Forms.Form.FormClosed event.
FormClosedEventArgs(closeReason: CloseReason)
"""
@staticmethod
def __new__(self, closeReason):
""" __new__(cls: type,closeReason: CloseReason) """
pass
Clos... | StarcoderdataPython |
6465121 | <reponame>iklasky/timemachines<gh_stars>100-1000
from timemachines.skaters.suc.successorinclusion import using_successor
if using_successor:
from successor.skaters.scalarskaters.allscalarskaters import SCALAR_SKATERS
SUCCESSOR_SKATERS = SCALAR_SKATERS
else:
SUCCESSOR_SKATERS = [] | StarcoderdataPython |
4969961 | <reponame>smallwater94/yt-concat<filename>yt_concate/pipeline/steps/download_captions.py<gh_stars>0
# ไธ่ผๅญๅน
from youtube_transcript_api import YouTubeTranscriptApi
from yt_concate.pipeline.steps.step import Step
import pickle
class DownloadCaptions(Step):
def process(self, transporter, inputs, utils):
prin... | StarcoderdataPython |
1748531 | from abaqusConstants import *
class DamageEvolution:
"""The DamageEvolution object specifies material properties to define the evolution of
damage.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
mdb.models[name].materials[name... | StarcoderdataPython |
3544309 | import pysmurf
import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import os
import seaborn as sns
import glob
S = pysmurf.SmurfControl(make_logfile=False,
epics_root='test_epics',
cfg_file='/usr/local/controls/Applications/'+\
... | StarcoderdataPython |
8008664 | <gh_stars>10-100
""" Process images with trained model """
from __future__ import print_function
import argparse
import os
from utilities.input_correction import Correction
__author__ = '<NAME>'
CHECKPOINT_PATH = './checkpoints/'
OUTPUT_PATH = './results/'
BATCH_SIZE = 128
CHECKPOINT_NAME = 'checkpoint.best.hdf5... | StarcoderdataPython |
4960265 | import pytest
from .fixtures import *
@pytest.mark.parametrize(
"original_df",
[
make_table(cols=1, astype="pandas"),
make_table(sorted_datetime_index, cols=1, astype="pandas"),
make_table(sorted_string_index, cols=1, astype="pandas"),
],
ids=["int index", "datetime index", "st... | StarcoderdataPython |
167944 | from django.db import models
# Create your models here.
class QuesModel(models.Model):
question = models.CharField(max_length=200, null=True)
op1 = models.CharField(max_length=200, null=True)
op2 = models.CharField(max_length=200, null=True)
op3 = models.CharField(max_length=200, null=True)
op4 =... | StarcoderdataPython |
5076763 | from numbers import Number
class Coordinates2D(list):
def __add__(self, other):
# print('--- ADD ---')
return self.__class__([self[0] + other[0], self[1] + other[1]])
def __iadd__(self, other):
# print('--- IADD ---')
return self.__class__([self[0] + other[0], self[1] + other[... | StarcoderdataPython |
1951860 | from django import template
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse
import time
register = template.Library()
@register.simple_tag
def get_monitoring_table(data):
context = {}
context["data"] = data
context["empty_data_holder"] = "<b></b>"
... | StarcoderdataPython |
5028558 | """
desispec.skymag
============
Utility function to compute the sky magnitude per arcmin2 based from the measured sky model
of an exposure and a static model of the instrument throughput.
"""
import os,sys
import numpy as np
import fitsio
from astropy import units, constants
from desiutil.log import get_logger
from... | StarcoderdataPython |
9755292 | <filename>system_desing.py
# -- --------------------------------------------------------------------------------------------------- -- #
# -- project: A python project for algorithmic trading in FXCM -- #
# -- -------------------------------------------------------------------... | StarcoderdataPython |
3361601 |
import luigi
import subprocess
from os.path import join, dirname, basename
from ..utils.cap_task import CapTask
from ..config import PipelineConfig
from ..utils.conda import CondaPackage
from ..databases.taxonomic_db import TaxonomicDB
from ..preprocessing.clean_reads import CleanReads
class KrakenUniq(CapTask):
... | StarcoderdataPython |
1871174 | """
hnn_geppetto.py
Initialise Geppetto, this class contains methods to connect the application with the Geppetto based UI
"""
import logging
import os
import sys
from contextlib import redirect_stdout
from jupyter_geppetto import synchronization
from . import nwb_data_manager
from .nwb_model_interpreter.nwb_reader i... | StarcoderdataPython |
9622338 | <gh_stars>1-10
#!/usr/bin/env python3
import os
import sys
import math
import pdb
from local import *
import time
import torch
import numpy as np
import torch.nn as nn
import torch.nn.init as init
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data imp... | StarcoderdataPython |
5007670 | from threading import Thread
def func1(length):
sum_f1 = 0
for x in range(0, length):
sum_f1 += x
print('Sum is {}'.format(sum_f1))
def func2(length):
""" Computes the sum of squares"""
sum_f2 = 0
for x in range(0, length):
sum_f2 += x * x
print('Sum of squares is {}'.forma... | StarcoderdataPython |
3572009 | class Solution:
def XXX(self, n: int) -> str:
if n==1:
return '1'
elif n==2:
return '11'
x=self.XXX(n-1)
y=''
count=1
for i in range(len(x)):
if i<len(x)-1 and x[i+1]==x[i]:
count+=1
else:
... | StarcoderdataPython |
5022471 | # -*- coding: utf-8 -*-
# Created by restran on 2017/9/15
from __future__ import unicode_literals, absolute_import
"""
ๅฝฑๅญๅฏ็
่ฏทๅๆไธๅๅฏๆ่ฟ่ก่งฃๅฏ 8842101220480224404014224202480122 ๅพๅฐflag๏ผflagไธบ8ไฝๅคงๅๅญๆฏ
ๆ7ไธช0๏ผๆๅผๅพๅฐ8ไธชๅญ็ฌฆ๏ผ็ถๅๆ่ฟไบๆฐๅญๅ ่ตทๆฅ๏ผๅพๅฐ8ไธชๆฐๅญ๏ผ่กจ็คบ26ไธชๅญๆฏไธญ็ฌฌๅ ไธชๅญๆฏ
88421 0 122 0 48 0 2244 0 4 0 142242 0 248 0 122
23 5 12 12 4 15 ... | StarcoderdataPython |
1863754 | import bisect
import collections
from tenet.util.log import pmsg
#-----------------------------------------------------------------------------
# analysis.py -- Trace Analysis
#-----------------------------------------------------------------------------
#
# This file should contain logic to further process, augme... | StarcoderdataPython |
273157 | import torch
import torchvision.utils as vutils
import glob, os
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--save_image", type=bool, default=False)
parser.add_argument("--save_video", type=bool, def... | StarcoderdataPython |
3459625 | from sanic import Sanic
from sanic.response import json
from imageboard.danbooru import Danbooru
app = Sanic("ihaboard-scrapper")
app.config.FORWARDED_HOST = "temporary_string"
def to_real_bool(string):
bool_map = {
"0": False,
"1": True,
"true": True,
"false": False,
"y":... | StarcoderdataPython |
11227114 | #!/usr/bin/env python
# coding: utf-8
import sys
sys.path.append('../')
# Config
from utils.misc import *
from config.UnityML_Agent import *
# Environment
from unityagents import UnityEnvironment
# Agent
from agent.DDPG import Agent
from agent.ExperienceReplay import ReplayBuffer
# Hyperparameter optimizer
import optu... | StarcoderdataPython |
31475 | # -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
from addonpayments.utils import GenerationUtils
class TestGenerationUtils:
def test_generate_hash(self):
"""
Test Hash generation success case.
"""
test_string = '20120926112654.thestore... | StarcoderdataPython |
3472865 |
import numpy as _np
import pandas as _pd
import matplotlib.pyplot as _plt
from scipy import fftpack as _fftpack
from scipy.signal import welch as _welch
# from scipy.signal.spectral import _spectral_helper
# from johnspythonlibrary2 import Plot as _plot
# from johnspythonlibrary2.Plot import subTitle as _subTitle, fi... | StarcoderdataPython |
11348546 | <filename>orca_gazebo/scripts/reliable_odom.py
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inclu... | StarcoderdataPython |
4971704 | <reponame>kotetsu99/ai_music<filename>04-ai_camera.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import keras
import numpy as np
import cv2
import picamera
import picamera.array
import os, sys
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.co... | StarcoderdataPython |
5194424 | import sys
import HTTPRequester
import PayloadGenerator
requests_location = None
option = None
max_threads = None
delay = None
os = None
dt = 0
def present():
global option, os, dt
if option == 'so':
print '[+] Testing for Soap Injection: '
if option == 'pp':
print '[+] T... | StarcoderdataPython |
38680 | <reponame>the-zebulan/CodeWars
from collections import Counter
from itertools import chain
def id_best_users(*args):
best_users = set.intersection(*(set(a) for a in args))
cnt = Counter(chain(*args))
users = {}
for k, v in cnt.iteritems():
if k in best_users:
users.setdefault(v, []... | StarcoderdataPython |
1634710 | <gh_stars>1-10
"""
MIT License
Copyright (c) 2020 Myer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, m... | StarcoderdataPython |
304745 | <gh_stars>10-100
"""Communicates with databases using repository pattern and service patterns"""
__version__ = '0.27.0'
from dbdaora.cache import CacheType, TTLDaoraCache
from dbdaora.circuitbreaker import AsyncCircuitBreaker
from dbdaora.data_sources.fallback import FallbackDataSource
from dbdaora.data_sources.fall... | StarcoderdataPython |
9722939 | import pyqrcode
from tkinter import *
import tkinter.ttk as ttk
from ttkthemes import ThemedTk
from PIL import Image,ImageTk
win = ThemedTk(theme="equilux")
win.title("QR Code Generator")
win.config(background="#181818")
def Generate():
text = entryl.get()
qr = pyqrcode.create(text)
file_name... | StarcoderdataPython |
11248934 | VISDOMWINDOWS = {}
def line_plot(viz, title, x, y):
if title in VISDOMWINDOWS:
window = VISDOMWINDOWS[title]
viz.line(X=[x], Y=[y], win=window, update='append', opts={'title': title})
else:
window = viz.line(X=[x], Y=[y], opts={'title': title})
VISDOMWINDOWS[title] = window
d... | StarcoderdataPython |
6411375 | <filename>python_backend/models/bpnet/bodyposenet_client.py
import argparse
from functools import partial
import logging
import os
import sys
from attrdict import AttrDict
import numpy as np
from tqdm import tqdm
import tritonclient.grpc as grpcclient
import tritonclient.http as httpclient
from tritonclient.utils imp... | StarcoderdataPython |
3225036 | #!/usr/bin/env python3
import csv
def read_employees(csv_file_location):
with open(csv_file_location) as file:
csv.register_dialect('empDialect', skipinitialspace=True, strict=True)
employee_file = csv.DictReader(open(csv_file_location), dialect = 'empDialect')
e... | StarcoderdataPython |
12840685 | <reponame>Roberto-Sartore/Python
"""Faรงa um programa que pergunte o preรงo de trรชs produtos e informe qual produto vocรช deve comprar,
sabendo que a decisรฃo รฉ sempre pelo mais barato"""
p1 = float(input('Digite a 1ยบ valor R$ : ').replace(',', '.'))
p2 = float(input('Digite a 2ยบ valor R$ : ').replace(',', '.'))
p3 = flo... | StarcoderdataPython |
11309451 | <reponame>01-Meyitzade-01/TgKATILMA<filename>src/handlers/excepts.py
import pathlib, json # noqa: E401
import logging
from aiogram import Bot, types
CONFIG = json.load(open(pathlib.Path.cwd().joinpath("src/config.json")))
logger = logging.getLogger(__name__)
async def on_err(event: types.Update, exception: Excepti... | StarcoderdataPython |
6678677 | """
Object's attributes cache.
"""
import json, traceback
from collections import OrderedDict, deque
from django.apps import apps
from django.conf import settings
from muddery.server.utils import utils
from muddery.server.utils.exception import MudderyError, ERR
from muddery.server.database.storage.memory_storage impo... | StarcoderdataPython |
11301885 | def stop():
pass
| StarcoderdataPython |
1809588 | import unittest
import asyncio
from suds.client import Client
import pandas as pd
from vat_check import get_dataframe_from_file, get_unique_VAT_numbers
from vat_check import get_vat_registration
class Test_vat_check(unittest.TestCase):
excel_file = './test_examples/example.xlsx'
csv_file = './test_examples/ex... | StarcoderdataPython |
11276783 | <reponame>beiyewp/lain-cli
from inspect import cleandoc
from urllib.parse import urlparse
from lain_cli.utils import (
RequestClientMixin,
context,
diff_dict,
ensure_str,
git,
rc,
tell_executor,
template_env,
)
def tell_webhook_client():
ctx = context()
obj = ctx.obj
confi... | StarcoderdataPython |
12312 | <filename>core/migrations/0010_wagtailsitepage_screenshot.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 23:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0009_wagtail112upgrade'),
]
operations = [
migrations... | StarcoderdataPython |
8148342 | class Configs():
years=['2018', '2017', '2016']
sleep_interval=0.01 | StarcoderdataPython |
8064101 | <reponame>Tomato1107/OpenQuadruped
import matplotlib.pyplot as plt
import numpy as np
from gen_suite import Path, Pose
# path parameters
contact_length = 30 # mm
dip_height = 20 # mm
dip_increment_0 = 10 # mm
dip_increment_1 = 5 # mm
waypoints = [Pose(0, 0, 0),
Pose(contact_length / 2, 0, 0),
... | StarcoderdataPython |
356202 | <gh_stars>1-10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bns',
'0048_wealthidxperdistrict_wealthidxperhh_wealthidxperlandscape_wealthidxpervillage'),
]
operations = [
migrations.RunSQL(
"""
CREATE OR REPLACE ... | StarcoderdataPython |
3301006 | <reponame>SpartanPlume/MysqldbPythonWrapper<gh_stars>0
"""File loading all the constants for python use"""
import argparse
import json
CONSTANTS_PATH = "./constants.json"
with open(CONSTANTS_PATH) as f:
data = json.load(f)
constants = argparse.Namespace(**data)
| StarcoderdataPython |
6635764 | # assignment 4 solution
def joints_to_hand(a1,a2,l1,l2):
Ex = l1 * cos(a1)
Ey = l1 * sin(a1)
Hx = Ex + (l2 * cos(a1+a2))
Hy = Ey + (l2 * sin(a1+a2))
return Ex,Ey,Hx,Hy
def minjerk(H1x,H1y,H2x,H2y,t,n):
"""
Given hand initial position H1x,H1y, final position H2x,H2y and movement duration t,
and the tot... | StarcoderdataPython |
3384465 | # -*- coding: utf-8 -*-
# Copyright: (c) 2021, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from contextlib import contextmanager
from ansible_collections.community.g... | StarcoderdataPython |
11345116 | <reponame>alexstaley/machine-learning<gh_stars>1-10
"""
<NAME> -- Student ID: 919519311
Assignment 2 -- February 2020
### HERE BEGINS THE Main.py FILE ###
This code creates a neural network of perceptron objects, runs the experiments
described in assignment 2, and displays the results in the p... | StarcoderdataPython |
5046761 | from cone.app.browser.ajax import AjaxAction
from cone.app.browser.ajax import ajax_form_fiddle
from cone.app.browser.utils import format_traceback
from cone.app.browser.utils import make_url
from cone.app.model import AppSettings
from cone.tile import Tile
from cone.tile import render_tile
from cone.tile import tile
f... | StarcoderdataPython |
9720316 | from datetime import datetime, timedelta
from app.api.validations import (
MISSING_PARAMS, INVALID_PARAMS, MISSING_BODY, INVALID_TYPE
)
from app.models import Resource
from app.utils import get_error_code_from_status
def create_resource(client,
apikey,
name=None,
... | StarcoderdataPython |
6582209 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-05-03 13:42
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.text import slugify
def generate_slugs(apps, schema_editor):
SponsoredEvent = apps.get_model('events', 'SponsoredEvent')
db_alias = schema... | StarcoderdataPython |
314587 |
from django.db import connection
from django.db.models import Q
from django.shortcuts import get_object_or_404
from tenant_schemas.utils import tenant_context
from cajas.tenant.models import Platform
from cajas.users.models.charges import Charge
from cajas.users.models.employee import Employee
def _get_queryset(kl... | StarcoderdataPython |
11251973 | <filename>bot.py
import asyncio
from asyncio.tasks import sleep
from datetime import time
import datetime
import discord
import aioschedule as schedule
import functools
import config
from discord.ext import tasks, commands
intents = discord.Intents.default()
intents.voice_states = True
textChannel = None
voiceChannel... | StarcoderdataPython |
11360176 | import copy
from plenum.test.test_node import ensureElectionsDone
from plenum.test.view_change.helper import add_new_node
from plenum.test.helper import checkViewNoForNodes
from plenum.test.pool_transactions.helper import demote_node
nodeCount = 6
old_commit = None
def test_future_primaries_replicas_increase(loop... | StarcoderdataPython |
11373738 | import tensorflow as tf
import numpy as np
from tqdm import trange
from utils.config_manager import Config
from data.datasets import ASRDataset
from utils.decorators import ignore_exception, time_it
from utils.scheduling import piecewise_linear_schedule
from utils.logging_utils import SummaryManager
from model.transfo... | StarcoderdataPython |
1995749 | import csv
import gzip
import re
import logging
import os
from dipper.sources.Source import Source
from dipper.models.Genotype import Genotype
from dipper.models.assoc.G2PAssoc import G2PAssoc
from dipper.models.Evidence import Evidence
from dipper.models.Provenance import Provenance
from dipper.models.Model import Mo... | StarcoderdataPython |
134158 | from os.path import join
import torchvision.datasets as datasets
__DATASETS_DEFAULT_PATH = '/media/ssd/Datasets/'
def get_dataset(name, train, transform, target_transform=None, download=True, datasets_path=__DATASETS_DEFAULT_PATH):
root = datasets_path # '/mnt/ssd/ImageNet/ILSVRC/Data/CLS-LOC' #os.path.join(dat... | StarcoderdataPython |
3347236 | <gh_stars>1-10
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | StarcoderdataPython |
11295839 | from django.urls import path
from rest_framework_simplejwt.views import (
TokenRefreshView,
)
from .views import (
RegisterAPIView,
LoginAPIView
)
urlpatterns = [
path('register', RegisterAPIView.as_view(), name='register'),
path('login', LoginAPIView.as_view(), name='login'),
path('refresh-tok... | StarcoderdataPython |
6563052 | import olexparser.convert as convert
class TurTurSegmentSummary:
"""
A Class representing a Tur Tur Segment Summary.
Each Tur Tur in the Turdata file lists 1 or more segment files associated to it.
A summary of the segment file is also stored in the Turdata file.
.. note::
These summaries... | StarcoderdataPython |
6628038 | from binding import *
from ..namespace import llvm
from ..ADT.StringRef import StringRef
from ..Module import Module
from ..LLVMContext import LLVMContext
llvm.includes.add('llvm/Bitcode/ReaderWriter.h')
ParseBitCodeFile = llvm.CustomFunction('ParseBitCodeFile',
'llvm_ParseBitCo... | StarcoderdataPython |
6483 | <gh_stars>0
#!/usr/bin/python
# mp4museum.org by <NAME> 2019
import os
import sys
import glob
from subprocess import Popen, PIPE
import RPi.GPIO as GPIO
FNULL = open(os.devnull, "w")
# setup GPIO pin
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(13, GPIO.IN, pull_up_down ... | StarcoderdataPython |
260105 | <reponame>Mauricio1xtra/python
# ๐จ Don't change the code below ๐
height = input("enter your height in m: ")
weight = input("enter your weight in kg: ")
# ๐จ Don't change the code above ๐
#Write your code below this line ๐
bmi = int(weight) / float(height) ** 2
bmi_as_int = int(bmi)
print(bmi_as_int)
#!Or
weight_a... | StarcoderdataPython |
6631384 | <filename>alpyro_msgs/actionlib_tutorials/averagingresult.py<gh_stars>1-10
from alpyro_msgs import RosMessage, float32
class AveragingResult(RosMessage):
__msg_typ__ = "actionlib_tutorials/AveragingResult"
__msg_def__ = "ZmxvYXQzMiBtZWFuCmZsb2F0MzIgc3RkX2RldgoK"
__md5_sum__ = "d5c7decf6df75ffb4367a05c1bcc7612"
... | StarcoderdataPython |
11243294 | # Generated by Django 4.0.2 on 2022-02-18 16:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('codiotix', '0004_alter_episode_video_alter_movie_image_and_more'),
]
operations = [
migrations.AddField(
model_name='webserie',
... | StarcoderdataPython |
11216232 | <filename>ritter.py
#!/usr/bin/env python3
from ritter.ritter import Ritter
ritter = Ritter()
ritter.start()
| StarcoderdataPython |
9771753 | import numpy as np
from mandlebrot import mandelbrot
def test_mandelbrot_small():
x = np.linspace(-2.25, 0.75, 10)
y = np.linspace(-1.25, 1.25, 10)
output = mandelbrot(x, y, 100, False)
assert output.shape == (10, 10) | StarcoderdataPython |
9669621 | <gh_stars>0
__description__ = \
"""
Class for displaying art on LED panels.
"""
__author__ = "<NAME>"
__date__ = "2017-01-01"
__all__ = ["display","art","sensors"]
from .art import ArtInstallation
from .display import Panel, Display
| StarcoderdataPython |
12801124 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
3387549 | <reponame>anuragpapineni/Hearthbreaker-evolved-agent<gh_stars>0
try:
import ctrnn # C++ extension
except ImportError:
print "CTRNN extension library not found!"
raise
def create_phenotype(chromo):
num_inputs = chromo.sensors
num_neurons = len(chromo.node_genes) - num_inputs
#num_outputs = chr... | StarcoderdataPython |
9790467 | # Longest Substring Without Repeating Characters: https://leetcode.com/problems/longest-substring-without-repeating-characters/
# Given a string s, find the length of the longest substring without repeating characters.
# In order to solve this problem we can go through the list with a sliding windowand take a count o... | StarcoderdataPython |
5186278 | import re
import pytest
from dbpunctuator.utils import DEFAULT_ENGLISH_NER_MAPPING, NORMAL_TOKEN_TAG
from tests.common import cleaned_data, processed_data # noqa: F401
punctuations = list(DEFAULT_ENGLISH_NER_MAPPING.keys())
@pytest.mark.usefixtures("cleaned_data")
def test_data_cleaning(cleaned_data): # noqa: F8... | StarcoderdataPython |
5105113 | <filename>egs/zeroth/s5/data/local/lm/buildLM/_scripts_/at_unicode.py
#
# Copyright 2017 Atlas Guide (Author : <NAME>)
#
# Apache 2.0
#
import unicodedata
import re
measureUnits = "".join(chr(i) for i in range(0xffff) if i >= 0x3380 and i<=0x33DD)
percents = ''.join(chr(i) for i in range(0xffff) \
if unicod... | StarcoderdataPython |
1819043 | <filename>workapp/models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.db.models.fields.files import ImageField
# Create your models here.
class Contact(models.Model):
name = models.CharField(max_length=20... | StarcoderdataPython |
49601 | name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
hist=dict()
for line in handle:
if line.startswith('From:'):
words=line.split()
if words[1] not in hist:
hist[words[1]]=1
else:
hist[words[1]]=hist[words[1]]+1
#print(hist)
n... | StarcoderdataPython |
57732 | <gh_stars>1-10
# Copyright 2017 The Australian National University
#
# 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.