id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1710834 | <reponame>stafak/nidaqmx-python<filename>nidaqmx/tests/test_multi_threading.py
import random
import pykka
import pytest
import sys
import nidaqmx
from nidaqmx.tests.fixtures import multi_threading_test_devices
from nidaqmx.tests.helpers import generate_random_seed
class Error(Exception):
pass
class NoFixtureD... | StarcoderdataPython |
39415 | t = int(input())
while (t!=0):
a,b,c = map(int,input().split())
if (a+b+c == 180):
print('YES')
else:
print('NO')
t-=1
| StarcoderdataPython |
75339 | <reponame>j1c/pipelines<filename>hcp_pipelines/main.py<gh_stars>0
import shutil
import subprocess
from argparse import ArgumentParser
from pathlib import Path
from hcp2bids import convert, get_data
from .utils import s3_upload
def run(cmd):
"""
Wrapper on `subprocess.run`.
Print the command.
Execute... | StarcoderdataPython |
92820 | <gh_stars>1-10
class WeekSchedule():
def __init__(self, dates=[], codes=[]):
self.weeknum = 0
self.dates = dates
self.codes = codes | StarcoderdataPython |
3228359 | <gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras_applications import inception_resnet_v2
InceptionResNetV2 = inception_resnet_v2.InceptionResNetV2
decode_predictions = inception_resnet_v2.decode_predictions
preprocess_input = incept... | StarcoderdataPython |
3272290 | <gh_stars>0
#!/usr/bin/env python3
import json
import uuid
import requests
base = "http://localhost:8000"
token = "foo"
put_headers = {"content-type": "application/json", "x-ersa-auth-token": token}
get_headers = {"x-ersa-auth-token": token}
def generate(endpoint, **kwargs):
item = kwargs
item["id"] = str... | StarcoderdataPython |
4838010 | import os
from PIL import Image
def ImageResize(name, height=300, width=300):
"""
This function resizes images
passed in as a parameter
"""
cwd = os.getcwd()
name = input("Name of Image: ")
image_path = cwd + "/" + name
img = Image.open(image_path)
resize = img.resize((height, wi... | StarcoderdataPython |
3204602 | #!/usr/bin/env python
"""Proposed fix."""
import os
import unittest
import gflags
FLAGS = gflags.FLAGS
def _get_output_dir():
return os.path.join(FLAGS.my_dir, 'my_subdir')
class MyTest(googletest.TestCase):
def setUp(self):
self.filename = os.path.join(_get_output_dir(), 'filename')
| StarcoderdataPython |
1761978 | <filename>example.py
from ipotscrape import run_scraper
mode = 0 # mode 0 save to db, mode 1 save to csv
symbols = ['adhi','adro','akra','antm','asii','asri','bbca','bbni','bbri','bbtn','bksl','bmri','bsde','cpin','elsa','excl','ggrm','hmsp','icbp','inco','indf','indy','inkp','intp','itmg','jsmr','klbf','lpkr','lp... | StarcoderdataPython |
192856 | from graphish.connector import GraphConnector
from graphish.search import Search
from graphish.delete import Delete
from graphish.mailfolder import MailFolder | StarcoderdataPython |
93988 | import re
def getValue(coeff):
if coeff == '-':
return -1
if coeff == '' or coeff == '+':
return 1
return int(coeff)
def extractCoeff(leftPart, desiredVariable, otherVariableNames):
variablePart = leftPart.split(desiredVariable)[0].strip()
if desiredVariable not in leftPart:
... | StarcoderdataPython |
3200137 | # Copyright - Transporation, Bots, and Disability Lab - Carnegie Mellon University
# Released under MIT License
"""
Basic Math Operations that wraps around numpy
"""
import numpy as np
__all__ = [
'distance', 'is_close', 'is_same', 'normalize'
]
def distance(p1, p2):
"""
Return the euclidean distance b... | StarcoderdataPython |
3333015 | # This file was auto generated; Do not modify, if you value your sanity!
import ctypes
import enum
from ics.structures.can_settings import *
from ics.structures.canfd_settings import *
class scan_hub_settings(ctypes.Structure):
_pack_ = 2
_fields_ = [
('can1', CAN_SETTINGS),
('canfd1', CANFD_... | StarcoderdataPython |
1797211 | """
Running Hiplot server
=====================
"""
# In order to use high plot, first install the library
#
# .. code::
#
# python -m pip install hiplot
#
# Then run hiplot using the proper fetcher
#
# .. code::
#
# python -m hiplot fetcher.fetch_epicimpoc_experiment
#
# Then open the url https://localhost:... | StarcoderdataPython |
53393 | #!flask/bi.python
from app import app
app.run(debug = True)
| StarcoderdataPython |
1726489 | <gh_stars>1-10
from .page_model import PageModel
__all__ = ["PageModel"]
| StarcoderdataPython |
3205004 | from gql import gql, Client, AIOHTTPTransport
class GQLClient:
def __init__(self):
# Select your transport with a defined url endpoint
transport = AIOHTTPTransport(url="http://localhost/graphql")
# Create a GraphQL client using the defined transport
self.client = Client(transport=t... | StarcoderdataPython |
1677712 | <reponame>sramphall/Travel-Agency-System<gh_stars>0
import sqlite3
import re
import os
import csv
import sys
import home_pg
# Database stuff
if os.path.exists('trvlag.db'):
connection = sqlite3.connect('trvlag.db')
cur = connection.cursor()
else:
connection = sqlite3.connect('trvlag.db')
... | StarcoderdataPython |
1653870 | <filename>blogauth/forms.py
from django.forms import ModelForm, Form
from django.db.models import CharField, EmailField
from . import models
class PermissionForm(ModelForm):
class Meta:
model = models.Permission
fields = ['name', ]
class PermissionDetailForm(Form):
name = CharField(max_leng... | StarcoderdataPython |
3239948 | """Homework Assignment #4: Lists
Details:
Create a global variable called myUniqueList. It should be an empty list to start.
Next, create a function that allows you to add things to that list. Anything that's
passed to this function should get added to myUniqueList, unless its value already exists in myUn... | StarcoderdataPython |
3378267 | <reponame>kcburge/awsrun<filename>src/awsrun/__init__.py<gh_stars>0
#
# Copyright 2019 FMR LLC <<EMAIL>>
#
# SPDX-License-Identifier: MIT
#
"""CLI and API to concurrently execute user-defined commands across AWS accounts.
## Overview
`awsrun` is both a CLI and API to execute commands over one or more AWS accounts
con... | StarcoderdataPython |
1695845 | import csv
from tempfile import NamedTemporaryFile
import shutil
class student():
points= []
first=[]
last=[]
full_name=[]
def __init__(self,status,n1,n2,p, std_data,num_of_std,name):
self.status = status
self.n1 = n1
self.n2 = n2
self.p = p
self.std_data=... | StarcoderdataPython |
4819424 | <reponame>dmilos/IceRay<gh_stars>1-10
import math
import IceRayCpp
def name( ):
return "sphere"
def make( P_height = 1 + 1 + (math.sqrt(5)-1)/2, P_sample = 32, P_radius = 0.3 ):
sphere = IceRayCpp.LightSphere()
sphere.center( IceRayCpp.MathTypeCoord3D().load(0,0,P_height) )
sphere.radius(... | StarcoderdataPython |
33169 | <gh_stars>100-1000
#!/usr/bin/env python
"""
docstring
"""
# Authors: <NAME>
import abc
import numpy as np
from sklearn.base import BaseEstimator
class RegressorMixin(object):
def __init__(self):
super(RegressorMixin, self).__init__()
@classmethod
def get_problem_type(cls):
return 'regression'
class Cla... | StarcoderdataPython |
3210529 | <reponame>dada00321/clothing_website<filename>shop/migrations/0011_genre.py
# Generated by Django 2.0.5 on 2021-02-20 15:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0010_auto_20210220_1946'),
]
operations = [
migrations.C... | StarcoderdataPython |
4806443 | <reponame>SERPWoo/API
#
# GitHub: https://github.com/SERPWoo/API
#
# This code requests a project's Notes and outputs the Note ID, Note Timestamp, Note Type, Note Message
#
# This output is text format
#
# Last updated - Aug 24th, 2017 @ 22:10 EST (@MercenaryCarter https://github.com/MercenaryCarter and https://twitter... | StarcoderdataPython |
58860 | <filename>code/basic-types.py
"""basic-types.py
Module for creating and running the basic types classifier.
Usage
$ python3 basic-types.py --train-semcor
Train a classifier from all of Semcor and save it in
../data/classifier-all.pickle.
$ python3 basic-types.py --train-test
Train a classifier from a ... | StarcoderdataPython |
3397926 | <reponame>jaaparenas/ExpAPP<filename>backend/app/core/routes.py
from . import core
from flask import jsonify, request, redirect
from datetime import datetime, timedelta
@core.route("/")
def index():
user_params = {
"ip" : request.remote_addr,
'date' : datetime.utcnow()
}
return jsonify(use... | StarcoderdataPython |
1705430 | <reponame>Submissions/scripts-for-nexus-pipeline<filename>generate_merged_bam_header.py
#!/usr/bin/env python
import os
import sys
sample = sys.argv[1]
tsv_file = sys.argv[2]
rg_incomplete_file = sys.argv[3]
project = sys.argv[4]
tsv_header_info = {}
with open(tsv_file) as f:
for raw_line in f:
line = ... | StarcoderdataPython |
192014 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mail.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.... | StarcoderdataPython |
198935 | import os
from fontbakery.status import PASS, FAIL, WARN, ERROR, INFO, SKIP
from fontbakery.section import Section
from fontbakery.callable import condition, check, disable
from fontbakery.message import Message
from fontbakery.fonts_profile import profile_factory
from fontbakery.profiles.opentype import OPENTYPE_PROF... | StarcoderdataPython |
3277428 | from pathlib import Path
import pandas as pd
#go to path and grab all excel files
excelFiles = list(Path("primary652018thesiliconvalleyorganizationpacgeneralpurposesupportballotmeasure").glob("*.xls"))
maindf = pd.DataFrame()
#adding data to maindf
for items in excelFiles:
tempdf = pd.read_excel(items)
maindf... | StarcoderdataPython |
3376166 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-01-07 06:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0365_auto_20200106_1539'),
]
ope... | StarcoderdataPython |
1709104 | <filename>tests/test_cgls.py
# Copyright (c) 2018, TU Wien, Department of Geodesy and Geoinformation
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retai... | StarcoderdataPython |
134336 | <reponame>City-of-Helsinki/kesaseteli
import csv
import datetime
import decimal
import operator
from dataclasses import dataclass
from io import StringIO
from typing import Callable, Union
from applications.enums import OrganizationType
@dataclass
class TalpaColumn:
heading: str
cell_data_source: str
for... | StarcoderdataPython |
16387 | """
Copyright 2021 Novartis Institutes for BioMedical Research 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 applicable law... | StarcoderdataPython |
57297 | import falcon
import six
from monitorrent.settings_manager import SettingsManager
# noinspection PyUnusedLocal
class SettingsNotifyOn(object):
def __init__(self, settings_manager):
"""
:type settings_manager: SettingsManager
"""
self.settings_manager = settings_manager
def on_... | StarcoderdataPython |
1767126 | <filename>general_bipedal_walker/simulation.py
import math
import numpy as np
import Box2D
from Box2D.b2 import (
edgeShape,
circleShape,
fixtureDef,
polygonShape,
revoluteJointDef,
contactListener
)
from .color import Color
class Terrain:
GRASS = 0
STUMP = 1
STAIRS = 2
PIT = 3
@staticmeth... | StarcoderdataPython |
3220114 | class Solution:
"""
@param s: a string
@return: return a integer
@ ???????
"""
def longestValidParentheses(self, s):
# write your code here
if not s:
return 0
res = 0
dp = [0 for i in range(len(s))] #初始化
for i in range(len(s) - 2, -1, -1) :
... | StarcoderdataPython |
62618 | s = input()
t = input()
print()
| StarcoderdataPython |
1721632 | <gh_stars>1-10
"""Link for the source video https://youtu.be/daefaLgNkw0 """
words = {
"book":"A thing where it has information ",
"pen":"A tool to write or take notes of data",
"pencil":["A pen but erasable","you can use an eraser"]
}
print(words)
print()
print(words["book"])
print()
print(words... | StarcoderdataPython |
83865 | <reponame>BenjaminJRitz/project-athena<filename>src/utils/model.py
"""
@author: <NAME> (y(dot)meng201011(at)gmail(dot)com)
"""
import argparse
import numpy as np
import os
import json
from keras.models import load_model, Model
from keras.utils import CustomObjectScope
from keras.initializers import glorot_uniform
im... | StarcoderdataPython |
3226716 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright 2017-2019 Spotify AB.
#
# 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 ... | StarcoderdataPython |
3368254 | from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import unittest
import socket
import aioredis
import asyncio
import time
soc = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
soc.connect(('8.8.8.8', 80))
G... | StarcoderdataPython |
3342863 | from django.db import models
from django import forms
from django.utils.text import get_text_list, capfirst
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes impo... | StarcoderdataPython |
1606880 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.express as px
import dash_bootstrap_components as dbc
import pandas as pd
import pickle as pk
import plotly.graph_objects as go
import numpy as np
from sklearn.preprocessi... | StarcoderdataPython |
1786579 | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | StarcoderdataPython |
195187 | <filename>coba/learners/corral.py<gh_stars>0
"""An implementation of the Corral algorithm."""
import math
from typing import Any, Sequence, Optional, Dict
from coba.random import CobaRandom
from coba.simulations import Context, Action, Key
from coba.learners.core import Learner
class CorralLearner(Learner):
"""... | StarcoderdataPython |
3316667 |
import signalqueue
from signalqueue.utils import json, logg
from signalqueue import SQ_RUNMODES as runmodes
class QueueBase(object):
"""
Base class for a signalqueue backend.
Implementors of backend interfaces will want to override these methods:
* ping(self) # returns a boole... | StarcoderdataPython |
168788 | # Visualize Reults with MatPlotlib etc...
import matplotlib.pyplot as plt
import numpy as np
class Visualization(object):
def __init__(self, dataset):
super().__init__()
self.dataset = dataset
self.estimated_state = None
self.estimated_varf = None
def getEstimatedValu... | StarcoderdataPython |
3286102 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_dialog_refi_export_endings.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog_refi_export_line_endings(object):
de... | StarcoderdataPython |
3265913 | #Imports all version subdirectories.
import os, importlib, re
from os.path import dirname, basename, isfile, join
import glob
from app.services import v1
#We get the path of the script
services_dir = os.path.dirname(os.path.realpath(__file__))
#We go through all subdirectories, mainly trying to catch directories su... | StarcoderdataPython |
3362879 | from freezegun import freeze_time
from datetime import datetime as datetime_aliased
from time import time as time_aliased
@freeze_time("1980-01-01")
def test_datetime_alias():
assert datetime_aliased.now() == datetime_aliased(1980, 1, 1)
@freeze_time("1970-01-01")
def test_time_alias():
assert time_aliased(... | StarcoderdataPython |
3271952 | <reponame>mellesies/thomas-app<gh_stars>0
# -*- coding: utf-8 -*-
import os, sys
import logging
from logging.handlers import RotatingFileHandler
from sqlalchemy.engine.url import make_url, URL
from appdirs import *
import yaml
from . import db
from . import util
from . import error
log = util.get_log(__name__)
c... | StarcoderdataPython |
1794221 | <gh_stars>0
#!/usr/bin/env python3
"""Github Pages CLI
"""
from pathlib import Path
from pprint import pprint
import click
from click import style
import tabulate as tabulate_module
from tabulate import tabulate
from .app import App
from .objects import LogLine
from .requests import (CommitRequest, DeploysRequest, J... | StarcoderdataPython |
3353717 | """List NAS accounts."""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command(cls=SLCommand)
@environment.pass_env
def cli(env):
"... | StarcoderdataPython |
1788466 | <reponame>maxcurie1996/SLiM
import numpy as np
if 1==1:
nu_list=np.arange(0.1,10.,0.5)
zeff_list=np.arange(1,2.5,0.2)
eta_list=np.arange(0.5,3.,0.2)
shat_list=np.arange(0.02,0.1,0.01)
beta_list=np.arange(0.0005,0.003,0.0003)
ky_list=np.arange(0.01,0.1,0.01)
mu_list=np.arange(0,4.,0.1)
xs... | StarcoderdataPython |
1686401 | <filename>pwn/heap-overflow/solve.py
from pwn import *
e = ELF("./vuln")
context.binary = e.path
if "--remote" in sys.argv:
s = ssh(host="2019shell1.picoctf.com", user="gamester543", password="")
p = s.run("/problems/heap-overflow_2_de0f6daa62288c9b3afb950888dc7166/vuln")
else:
p = process([e.path]
)
#{"LD... | StarcoderdataPython |
120257 | from math import e
def pi_dec(n):
if n > 15 or n < 1:
print("\nPlease provide a valid number in range of 1 to 15...")
else:
print(f"E = {str(e)[0:n+2]}")
pi_dec(n=int(input("\nUp to how many decimal places do you want the value of 'e'? \n> "))) | StarcoderdataPython |
86683 | <filename>lib/schemacfg/sip.py
#! /usr/bin/python
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2013 Dr. <NAME> Open Source Consulting.
# Reichergasse 131, A-3411 Weidling.
# Web: http://www.runtux.com Email: <EMAIL>
# All rights reserved
# ****************************************************************************
#
#... | StarcoderdataPython |
3355496 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 <NAME> <<EMAIL>>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-08-17
#
"""Alfred-Workflow library for building Alfred 3/4 workflows."""
import subprocess
from os.path import dirname, join
from setuptools import setup
from se... | StarcoderdataPython |
58813 | <filename>nlcodec/term_freq.py
#!/usr/bin/env python
#
# Author: <NAME> [tg (at) isi (dot) edu]
# Created: 6/13/20
import json
import logging as log
from pathlib import Path
from typing import List, Dict, Tuple
from nlcodec import spark as spark_util
from nlcodec import __version__, __epilog__
log.basicConfig(level... | StarcoderdataPython |
3240536 | # coding=utf-8
# @Time:2021/6/210:11
# @author: SinGaln
"""处理加载数据"""
import os
import ast
import copy
import json
import torch
import logging
from utils import get_labels
from torch.utils.data import TensorDataset
logger = logging.getLogger(__name__)
class InputExample(object):
"""
输入的为两个句子,利用[SEP]进行分隔
... | StarcoderdataPython |
3347647 | <reponame>Hallflower20/skyportal
import datetime
import numpy.testing as npt
import uuid
from skyportal.tests import api
def test_candidate_list(view_only_token, public_candidate):
status, data = api("GET", "candidates", token=view_only_token)
assert status == 200
assert data["status"] == "success"
def... | StarcoderdataPython |
4837538 | <reponame>chaichana-t/hand-gestures-smart-home<gh_stars>0
import cv2
from datetime import datetime
from hand_gesture.prediction import hand_gesture_inference
from hand_gesture.config import class_names_to_idx, widths
from config import time_interval
from api.light import light_action
print('Initializing webcam...... | StarcoderdataPython |
109868 | from pylusat._version import __version__
| StarcoderdataPython |
12833 | class Solution:
def maxLength(self, arr) -> int:
def helper(word):
temp=[]
temp[:0]=word
res=set()
for w in temp:
if w not in res:
res.add(w)
else:
return None
return res
... | StarcoderdataPython |
1713385 | <filename>storeapp/apps.py
from django.apps import AppConfig
class StoreappConfig(AppConfig):
name = 'storeapp'
| StarcoderdataPython |
4816317 | import requests
class Api:
# Constructor
def __init__(self, **kwargs):
self.__base_api_path = kwargs.get("base_api_path","https://pipl.ir/v1/")
self.__headers = kwargs.get("headers", {})
# Getters
def get_base_api_path(self) -> str:
return self.__base_api_path
def get_header... | StarcoderdataPython |
4812002 | from django.conf.urls import url
from ..views.admin import AnnouncementAdminAPI
urlpatterns = [
url(r"^announcement/?$", AnnouncementAdminAPI.as_view(), name="announcement_admin_api"),
]
| StarcoderdataPython |
1640656 | from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from rest_framework_simplejwt.state import User
from artwork.views.comment import CancelVoteForCommentAPIView
from tests.common import APIFactoryTestCase
class CancelVoteForCommentAPITestCase(APIFacto... | StarcoderdataPython |
144789 | import asyncio
import os
import tempfile
from pathlib import Path
from typing import Optional, Union
from aiofiles import os as aiofiles_os
from aiohttp.abc import AbstractStreamWriter
from aiohttp.typedefs import LooseHeaders
from aiohttp.web import FileResponse
makedirs = aiofiles_os.wrap(os.makedirs) # as in aiof... | StarcoderdataPython |
3307760 | import os
import logging
from colorlog import ColoredFormatter
from datetime import *
log_file_enable = True
def get_logger():
"""Return a logger with a default ColoredFormatter."""
formatter = ColoredFormatter(
"%(log_color)s[%(levelname)-8s] [%(filename)s:%(lineno)d]: %(log_color)s%(message)s",
... | StarcoderdataPython |
3315628 | <filename>tests/test_backends.py<gh_stars>10-100
import os
import pytest
from vivid.backends.dataframes import CSVBackend, JoblibBackend, FeatherBackend, DataFrameBackend
@pytest.mark.parametrize('name,expect', [
('my-file', 'my-file.csv'),
('user.hoge', 'user.csv'),
('/path/to/myfile.foo', '/path/to/my... | StarcoderdataPython |
96821 | <filename>chef_validator/common/exception.py
# -*- coding: utf-8 -*-
# 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 require... | StarcoderdataPython |
165846 | <filename>Turtles/index19.py
import turtle
import random
riley = turtle.Turtle()
riley.width(5)
mood = random.choice(["happy", "sad", "angry", "party"])
if mood == "happy":
riley.color("yellow")
elif mood == "sad":
riley.color("blue")
elif mood == "angry":
riley.color("red")
elif mood == "party":
... | StarcoderdataPython |
198062 | # -*- coding: utf-8 -*-
def main():
s = input()
mod = ''
for i in range(3):
if s[i] == '1':
mod += '9'
elif s[i] == '9':
mod += '1'
print(mod)
if __name__ == '__main__':
main()
| StarcoderdataPython |
1780300 | from flask import Flask, jsonify, request, render_template, flash, request, redirect, url_for, send_from_directory
import os
import io
import json
from flask_cors import CORS
import yaml
from sys import getdefaultencoding
import http.server
import socketserver
from urllib.parse import urlparse
import os
from thread... | StarcoderdataPython |
1639538 | from concurrent import futures
import random
import grpc
from recommendations_pb2 import BookCategory, BookRecommendation, RecommendationResponse
import recommendations_pb2_grpc
books_by_category = {
BookCategory.MYSTERY: [BookRecommendation(id=1, title="The Maltese Falcon"), BookRecommendation(id=2, title="Mu")]... | StarcoderdataPython |
3351757 | import pymel.core as pm
import pulse.nodes
import pulse.spaces
import pymetanode as meta
from pulse.buildItems import BuildAction, BuildActionError
from pulse.views.contextmenus import PulseNodeContextSubMenu
class CreateSpaceAction(BuildAction):
def validate(self):
if not self.node:
raise B... | StarcoderdataPython |
1645889 | import os, string, glob, sys
from scipy import *
import scipy.io.array_import
EXT='*.x_y'
TEMPEXT='*_temp.dat'
OUTFILE ='tixrpd_out.dat'
PLOTFILE ='tixrpd_plot.eps'
TEMPFILE=glob.glob(os.getcwd()+'/'+TEMPEXT)[0]
TIMESTEP=150
LOWER=27.
UPPER=28.5
A=3000.
B=27.5
C=0.1
D=300
initpar= []
initpar.append(A), initpar.append... | StarcoderdataPython |
150386 | # 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 to in... | StarcoderdataPython |
3267811 | <reponame>suncht/sun-python<gh_stars>0
class Student(object):
def __init__(self, name, score):
self.name = name
self.__score = score
self._age = 10
@property
def score(self):
return self.__score
@score.setter
def score(self, score):
if score < 0 or score > 1... | StarcoderdataPython |
1761609 | <gh_stars>1-10
import django_filters
from django.db.models import Q
from rest_framework_gis.filterset import GeoFilterSet
from django_filters.rest_framework import FilterSet
from rest_framework_gis.filters import GeometryFilter
from vocabs.models import SkosConcept
from . models import TempSpatial, Source
class Sour... | StarcoderdataPython |
157086 | # -*- coding:utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | StarcoderdataPython |
6796 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functions used for data handling
"""
__author__ = "<NAME>, GIScience Research Group, Heidelberg University"
__email__ = "<EMAIL>"
import os
import yaml
from shapely.geometry import box
import numpy as np
import pandas as pd
import geopandas as gpd
import json
from nb_... | StarcoderdataPython |
3232400 | from copy import deepcopy
def deepupdate(target, src):
"""Deep update target dict with src
For each k,v in src: if k doesn't exist in target, it is deep copied from
src to target. Otherwise, if v is a list, target[k] is extended with
src[k]. If v is a set, target[k] is updated with v, If v is a dict,
... | StarcoderdataPython |
3235565 | <reponame>python-useful-helpers/exec-helpers
# Copyright 2018 - 2021 <NAME> aka penguinolog.
# 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/licens... | StarcoderdataPython |
43014 | <reponame>UtkarshPathrabe/Competitive-Coding<gh_stars>10-100
class Solution:
def bagOfTokensScore(self, tokens: List[int], P: int) -> int:
tokens.sort()
tokens, maxScore, currentScore = deque(tokens), 0, 0
while tokens and (P >= tokens[0] or currentScore):
while tokens and P >= t... | StarcoderdataPython |
3396664 | from .info import BatchInfo, EpochInfo, TrainingInfo
from .learner import Learner
from vel.internals.model_config import ModelConfig
| StarcoderdataPython |
138258 | <reponame>lepisma/coevo<gh_stars>0
# -*- coding: utf-8 -*-
"""
Population selection and ranking functions
"""
import numpy as np
def roulette(fitness_values, return_size, elite=0):
"""
Perform a roulette wheel selection
Return return_size item indices
"""
sorted_indices = np.argsor... | StarcoderdataPython |
171287 | """ Contains all the logic """
from enum import Enum
# R1 R2
# --[======]-----[======]--
# | | |
# V_in V_out GND
# V_out / V_in = R2 / (R1 + R2)
# resistor_ratio = R1 / R2
class RatioType(Enum):
""" Allows distinguishing between resistor ratios ... | StarcoderdataPython |
3350231 | <reponame>MaLei666/oms
"""
User app
"""
from django.urls import path
from .views import *
app_name = 'spider_data'
urlpatterns = [
# 问题列表页
path('questionlist', Zhihu_Q_View.as_view(), name='zhihu_list'),
path('answerlist/<int:question_id>', Zhihu_A_View.as_view(), name='zhihu_info'),
path('dplist', D... | StarcoderdataPython |
88804 | from django.db import models
# Create your models here.
class System(models.Model):
hostname = models.CharField(max_length=128,default="firewall")
domain = models.CharField(max_length=128,default="lan")
apply_iptables = models.BooleanField(default=True)
apply_ipaddrs = models.BooleanField(default=Fals... | StarcoderdataPython |
1624197 | from magma import *
from mantle import And
from .ring import Ring
__all__ = ['CascadedRing']
def CascadedRing(nlist, has_ce=False, **kwargs):
"""
n cascaded shift registers in a ring
"""
if has_ce:
ce = In(Bit)()
args = ['CE', ce]
else:
ce = 1
args = []
for i ... | StarcoderdataPython |
84973 | <filename>DataNexus/datahandler.py
"""
Handles ECoG dataset
"""
import numpy as np
class DataHandler:
@staticmethod
def split(ratio, data, labels):
idx_train = np.random.choice(range(0, data.shape[0]), size=int(data.shape[0] * ratio), replace=False)
idx_val = list(set(range(0, data.shape[0]))... | StarcoderdataPython |
3299797 | import sys
import pandas as pd
import numpy as np
import logging
from horus.core.util import definitions
from nltk.corpus import stopwords
from nltk import LancasterStemmer, re
from horus.core.config import HorusConfig
lancaster_stemmer = LancasterStemmer()
stop = set(stopwords.words('english'))
loggingLevel = loggi... | StarcoderdataPython |
3321462 | <reponame>jgeofil/avax-python
# avax-python : Python tools for the exploration of the Avalanche AVAX network.
#
# Find tutorials and use cases at https://crypto.bi
"""
Copyright (C) 2021 - crypto.bi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documenta... | StarcoderdataPython |
3311700 | <reponame>Willy5s/Pirates-Online-Rewritten
from pirates.piratesbase import PiratesGlobals
from pirates.teleport.TeleportGlobals import TeleportErrors
from pirates.teleport.DistributedFSMOV import DistributedFSMOV
class DistributedTeleportActorOV(DistributedFSMOV):
@report(types=['args'], dConfigParam=['dteleport'... | StarcoderdataPython |
1722369 | <filename>series/apps.py<gh_stars>1-10
from django.apps import AppConfig
class SeriesConfig(AppConfig):
name = 'series'
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.