id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4906001 | <reponame>t3kt/raytk
def onOffToOn(panelValue):
ext.tester.onCountLabelClick(panelValue.owner) | StarcoderdataPython |
6417692 | import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
import pandas as pd
from PIL import Image
from collections import defaultdict
import pickle
import face_recognition
import glob
import sklearn
import skimage.io as io
import skimage.filters as flt
from skimage.feature import greycomatrix, greycopr... | StarcoderdataPython |
5087239 | <reponame>soma2000-lang/colour<filename>colour/models/rgb/transfer_functions/tests/test_blackmagic_design.py
"""
Defines the unit tests for the :mod:`colour.models.rgb.transfer_functions.\
blackmagic_design` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (
oetf_Bla... | StarcoderdataPython |
9790909 | # Copyright 2017 FUJITSU LIMITED
#
# 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 writ... | StarcoderdataPython |
3251010 | <reponame>jjwatts/gigantum-client
# Copyright (c) 2017 FlashX, LLC
#
# 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, cop... | StarcoderdataPython |
6468750 | # This file is Copyright 2007, 2009 <NAME>.
#
# This file is part of the Python-on-a-Chip program.
# Python-on-a-Chip is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
#
# Python-on-a-Chip is distributed in the hope that it will be useful... | StarcoderdataPython |
159865 | import json
import sys
import datetime
from os import getenv
from dotenv import load_dotenv
from notion import NotionHelper
from rabbit import RabbitHelper
load_dotenv()
notion_helper = NotionHelper()
# get discord id to notion id list
result = notion_helper.get_discord_list(getenv('NOTION_ID_LIST'))
discord_to_noti... | StarcoderdataPython |
216787 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 12 11:24:47 2021
@author: mshahzamal
"""
import numpy as np
import pandas as pd
from flask import Flask, request, jsonify, render_template
import pickle
#naming our app as app
app= Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
@app.route(... | StarcoderdataPython |
114225 | from discord.ext.commands import Cog
from discord.ext.commands import CheckFailure
from discord.ext.commands import command, has_permissions
from discord.ext.menus import MenuPages, ListPageSource
from datetime import datetime, timedelta
from random import randint
from typing import Optional
from discord import Memb... | StarcoderdataPython |
5117096 | <reponame>ben-hunter-hansen/matrix-api
from .matrix import Matrix
from .matrix import util
| StarcoderdataPython |
155700 | #!/usr/bin/python
#------------------------------------------------------------------------------
# Name: plotUpperLimits.py
# Author: <NAME>, 20150212
# Last Modified: 20150212
#This is to read upper limits files and plot them so another Python script
# createHTML.py, can display them at the end of... | StarcoderdataPython |
1957483 | <reponame>shvetsiya/carvana<gh_stars>10-100
import cv2
import torch
import numpy as np
from tensorboardX import SummaryWriter
import shutil
class Callback:
def __call__(self, *args, **kwargs):
raise NotImplementedError
class TensorBoardVisualizerCallback(Callback):
def __init__(self, path_to_files):
... | StarcoderdataPython |
9685166 | #!/usr/bin/python
# Import necessary libraries
import os
import pandas as pd
import matplotlib.pyplot as plt
import spacy
nlp = spacy.load("en_core_web_sm") #initialize spaCy
from spacytextblob.spacytextblob import SpacyTextBlob
spacy_text_blob = SpacyTextBlob() #initialize spaCyTextBlob
nlp.add_pipe(spacy_text_blob)... | StarcoderdataPython |
11312484 | <filename>macro/tutorial/bundles/01_indexing.py
#!/usr/bin/env python
from gna.expression.index import *
#
# 0d index
#
nidx = NIndex(fromlist=[])
print('Test 0d index')
for i, nit in enumerate(nidx):
print(' iteration', i)
print(' index: ', nit.current_format() or '<empty string>')
print(' ful... | StarcoderdataPython |
3566256 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class Command_ErrorDetectionNet(nn.Module):
"""
Baseline model for the Error Detection task, in which the label for each
data point is either 1 (degraded) or 0 (not degraded).
Adapted from: https://github.com/clarava... | StarcoderdataPython |
6632722 | # template generated by /usr/local/lib/python3.6/dist-packages/colcon_python_shell/shell/python_shell.py
# This script extends the environment for this package.
import pathlib
# assumes colcon_current_prefix has been injected into globals by caller
assert colcon_current_prefix
def prepend_unique_path(envvar, subdire... | StarcoderdataPython |
1717161 | <filename>saulscript/__init__.py<gh_stars>0
import exceptions
import runtime
from runtime import Context
| StarcoderdataPython |
3378077 | <gh_stars>0
#
# Copyright 2013 Geodelic
#
# 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 o... | StarcoderdataPython |
8081501 | import pytest
import numpy as np
from stellarphot.photometry import calculate_noise
from stellarphot.core import Camera
GAINS = [1.0, 1.5, 2.0]
def test_calc_noise_defaults():
# If we put in nothing we should get zero back
assert calculate_noise() == 0
@pytest.mark.parametrize('aperture_area', [5, 20])
@p... | StarcoderdataPython |
3338402 | import unittest
from unittest.mock import patch
from gym_powerworld.envs import voltage_control_env
# noinspection PyProtectedMember
from gym_powerworld.envs.voltage_control_env import LOSS, \
MinLoadBelowMinGenError, MaxLoadAboveMaxGenError, OutOfScenariosError, \
MIN_V, MAX_V, MIN_V_SCALED, MAX_V_SCALED, _sca... | StarcoderdataPython |
129169 | # NOTE: This is a copy from ~/DevPriv/PythonProjects/MediaWikiMgmt/jk_mediawikirepo/src/jk_mediawikirepo/app/*
import jk_console
from .CLIForm import CLIForm
from .IOutputWriter import IOutputWriter
FG = jk_console.Console.ForeGround
SECTION_COLOR = FG.STD_LIGHTCYAN
SUBSECTION_COLOR = FG.STD_LIGHTCYAN
cla... | StarcoderdataPython |
307023 | from typing import Callable
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import streamlit as st
from sympy import diff, lambdify, parse_expr
from src.common.consts import COLOR, TRANSFORMATIONS
from src.common.methods.numerical_differentiation.first_derivative_finder import FirstDerivative... | StarcoderdataPython |
12825227 | import logging
import pandas as pd
import numpy as np
from spaceone.core.manager import BaseManager
from spaceone.statistics.error import *
from spaceone.statistics.connector.service_connector import ServiceConnector
_LOGGER = logging.getLogger(__name__)
_JOIN_TYPE_MAP = {
'LEFT': 'left',
'RIGHT': 'right',
... | StarcoderdataPython |
214395 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
import jpath
from lck.django.common.models import MACAddressField
from lck.lang import Null, nullify
from lck.xml import etree_to_dic... | StarcoderdataPython |
1977780 | <gh_stars>1-10
import ephem
from ephem import degree
class Coordinates:
# init function creates pyephem observer and stores it in self
def __init__(self, lat, lon, alt, az):
self.QTH = ephem.Observer()
self.QTH.lat = str(lat)
self.QTH.lon = str(lon)
self.QTH.pressure = 0
... | StarcoderdataPython |
1887409 | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.viewsets import ViewSet
# Create your views here.
from C_databases.models import BookInfo
from book_serializer.serializers import BookInfoSerializer
from rest_framework.response import Response
class BooksView(ViewSet):
... | StarcoderdataPython |
8020007 | #!/usr/bin/env python3
"""
@summary: how to send a signed transaction
@version: v03 (6/March/2020)
@since: 6/March/2020
@author: https://github.com/drandreaskrueger
@see: https://github.com/drandreaskrueger/chainhammer-substrate for updates
"""
import time, sys
from pprint import pformat
from threading import ... | StarcoderdataPython |
3269310 | from django.test import TestCase
from hello.twitter_api import (
TwitterCli,
get_twitter_comments,
json_into_table,
save_tweets
)
import io
import json
try:
from urllib.error import HTTPError
except ImportError:
from urllib2 import HTTPError
with io.open("hello/tests/example_twit.json") as sa... | StarcoderdataPython |
57063 | # <NAME>
# initial version of the webcam detector, can be used to test HSV settings, radius, etc
import cv2
#import time
import numpy as np
#from infer_imagenet import *
FRAME_WIDTH = 640
FRAME_HEIGHT = 480
# load in the video
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,FRAME_WIDTH)
cap.se... | StarcoderdataPython |
12863114 | <filename>scripts/update_covid_tracking_data.py<gh_stars>0
import logging
import datetime
import pathlib
import pytz
import requests
import pandas as pd
DATA_ROOT = pathlib.Path(__file__).parent.parent / "data"
_logger = logging.getLogger(__name__)
class CovidTrackingDataUpdater(object):
"""Updates the covid trac... | StarcoderdataPython |
3562202 | #!/usr/bin/env python
# Copyright 2018 ARC Centre of Excellence for Climate Systems Science
# author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | StarcoderdataPython |
6566697 | <filename>venv/lib/python3.6/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_storage_auto_giveback.py<gh_stars>1-10
#!/usr/bin/python
# (c) 2021, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, div... | StarcoderdataPython |
3431308 | import openmc
import pytest
from tests.testing_harness import PyAPITestHarness
@pytest.fixture
def model():
model = openmc.model.Model()
mat = openmc.Material()
mat.set_density('g/cm3', 10.0)
mat.add_nuclide('U235', 1.0)
model.materials.append(mat)
sph = openmc.Sphere(r=100.0, boundary_type=... | StarcoderdataPython |
3387541 | <filename>e2xgrader/preprocessors/validateextracells.py
import traceback
from nbgrader.nbgraderformat import ValidationError
from nbgrader.preprocessors import NbGraderPreprocessor
from ..utils.extra_cells import is_singlechoice
class ExtraCellValidator:
def validate_cell(self, cell):
if 'nbgrader' no... | StarcoderdataPython |
9647492 | <reponame>sdevkota007/MedicalColorTransfer
import cv2
import numpy as np
import argparse
parser = argparse.ArgumentParser()
# parser.add_argument('--resize_ratio', type=float, default=0.5)
# parser.add_argument('--weight', type=int, default=2, choices=[2, 3])
parser.add_argument('--img_mri', type=str, default='data/7... | StarcoderdataPython |
1799578 | <gh_stars>0
# Copyright 2018 Google Inc. 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 applica... | StarcoderdataPython |
1635535 | from .resource import DialpadResource
class CompanyResource(DialpadResource):
"""CompanyResource implements python bindings for the Dialpad API's company endpoints.
See https://developers.dialpad.com/reference#company for additional documentation.
"""
_resource_path = ['company']
def get(self):
"""Ge... | StarcoderdataPython |
6508753 | <reponame>x06lan/mt<filename>leetcode/210.py
first=""
save={}
data=[[1,0],[0,1]]
for i in data:
a=i[0]
b=i[1]
if a==first or first=="":
first=b
try:
tem=save[b]
except:
save[b]=[]
save[b].append(a)
def allpath(text,data,num):
if num==len(text):
# print("@"... | StarcoderdataPython |
12860949 | """
Copyright (C) 2018-2020 Intel Corporation
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 i... | StarcoderdataPython |
3503634 | from pych.extern import Chapel
@Chapel(sfile="sfile.hello.chpl")
def hello_world():
return None
if __name__ == "__main__":
hello_world()
| StarcoderdataPython |
8014516 | # --------------------------------------------------------
# Tensorflow VCL
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code from <NAME>, <NAME> and <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ impo... | StarcoderdataPython |
1661790 | ##############################################################################
#
# Copyright (c) 2014, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of hubspot-contacts
# <https://github.com/2degrees/hubspot-contacts>, which is subject to the
# provisions of the BSD at
# <http://dev.2degreesnetwork.com... | StarcoderdataPython |
3321204 | import numpy as np
import datetime
import os
import argparse
from FortnitePlotWorld import generate_player_traces
from FortnitePlotWorld import PlayerTrace
import logjoiner
import fnplog
import trafficstat
CLIENT_SPECTATOR = (19.359, 2.6462)
CLIENT_ACTIVE = (43.868, 7.9772)
SERVER_LOW = (81.572, 34.467)
SERVER_HIGH = ... | StarcoderdataPython |
5181536 | <gh_stars>1-10
from django.shortcuts import render,redirect,HttpResponseRedirect
from django.contrib.auth import authenticate,login,logout
from django.contrib import messages
from notification.signals import notify
from .forms import UserCreationForm,LoginForm
from .models import MyUser
# Create your views here.
def u... | StarcoderdataPython |
5176475 | # Run celery workers
# celery -A dao worker --loglevel=info
import sys
import json
import psycopg2
import logging
from celery import Celery
from datetime import datetime
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
# Configure with your o... | StarcoderdataPython |
11377063 | from conan.packager import ConanMultiPackager
if __name__ == "__main__":
builder = ConanMultiPackager(username="drodri", channel="stable")
builder.add_common_builds(shared_option_name="HelloCi:shared")
builder.run() | StarcoderdataPython |
6597496 | <gh_stars>10-100
import logging
import torch
from pydantic import BaseModel
from transformers import DistilBertForTokenClassification, DistilBertTokenizerFast
from dbpunctuator.utils.utils import register_logger
logger = logging.getLogger(__name__)
register_logger(logger)
device = torch.device("cuda") if torch.cuda... | StarcoderdataPython |
252999 | <filename>while_loops.py
# Example 1
i = 0
while i <= 10:
print(i)
i += 1
# Example 2
available_fruits = ["Apple", "Pearl", "Banana", "Grapes"]
chosen_fruit = ''
print("We have the following available fruits: Apple, Pearl, Banana, Grapes")
while chosen_fruit not in available_fruits:
chosen_fruit = input("... | StarcoderdataPython |
11378794 | import numpy as np
def center_crop(l, x, y, ts, p, bboxes, old_shape, new_shape):
"""
Crops events and annotations to a centered region of the specified shape.
Events and bounding boxes are then shifted so that the top-left event margins
always start at (0,0)
"""
new_h, new_w = new_shape
... | StarcoderdataPython |
3505031 | class Restaurant():
def __init__(self, name, c_type):
self.name = name
self.c_type = c_type
self.served = 0
def describe_R(self):
print("\nName: " + self.name + "\nCuisine Type: " + self.c_type + "\nCustomers: " + str(self.served))
def open_R(self):
... | StarcoderdataPython |
5010492 | from mpkg.common import Soft
from mpkg.load import Load
from mpkg.utils import GetPage
class Package(Soft):
ID = 'ffmpeg'
def _prepare(self):
data = self.data
data.bin = [r'bin\ffmpeg.exe', r'bin\ffplay.exe', r'bin\ffprobe.exe']
parser = Load('http/common-zpcc.py', sync=False)[0][0].g... | StarcoderdataPython |
9683026 | <reponame>aiaio/django-svn-revision<gh_stars>1-10
# $Id: django-revision.py $
# Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
"""
Creates a template tag called {% revision %} that returns the current svn version.
Requires svnversion.
"""
import sys, os
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file... | StarcoderdataPython |
6413725 | import dash
from utils.code_and_show import example_app
dash.register_page(__name__, description="Interactively change the legend position")
filename = __name__.split("pages.")[1]
notes = """
#### Plotly Documentation:
- [How to configure and style the legend](https://plotly.com/python/legend/)
#### Contrib... | StarcoderdataPython |
1698065 | from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib
#matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from matplotlib.colors import colorConverter
import os
import ast
from scipy import ndimage
import paras_dorsoventral as dors
import para... | StarcoderdataPython |
11350378 | import numpy as np
import pandas as pd
import numpy.testing as npt
from ..viewers import topic_mapping
from ..cooking_machine.models.base_model import BaseModel
class dummy_model(BaseModel):
def __init__(self, matrix):
self.values = matrix
def get_phi(self, class_ids):
""" """
index =... | StarcoderdataPython |
11219265 | <gh_stars>0
#!/usr/bin/python3
'''Module for a minecraft villager app in python3'''
#pylint: disable=E0611,W0611,W0201,W0640,C0301,C0200,W0613,R0201
from time import sleep
from functools import partial
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.app import App
from kivy.config import Co... | StarcoderdataPython |
12817270 | """
This module contains test cases for Privex's Python Helper's (privex-helpers).
Testing pre-requisites
----------------------
- Ensure you have any mandatory requirements installed (see setup.py's install_requires)
- You should install ``pytest`` to run the tests, it works much better than standard python... | StarcoderdataPython |
1902217 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from .views import index as home
urlpatterns = [
url(r'^$', home, name='index'),
url(r'^store/$', include('store.urls')),
url(r'^admin/', include(admin.site.urls)),
]
# settings for development environment DEBUG
from d... | StarcoderdataPython |
11222751 | <filename>CircuitPython_Made_Easy_On_CPX/cpx_slide_switch/code.py
# SPDX-FileCopyrightText: 2017 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
from adafruit_circuitplayground.express import cpx
while True:
print("Slide switch:", cpx.switch)
time.sleep(0.1)
| StarcoderdataPython |
9718669 | <filename>vitrage/common/utils.py
# -*- encoding: utf-8 -*-
# Copyright 2015 - Alcatel-Lucent
# Copyright © 2014-2015 eNovance
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 <NAME>
#
# Licensed under the Apache Licen... | StarcoderdataPython |
1806573 | <gh_stars>0
# 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, software
# distrib... | StarcoderdataPython |
9745435 | <filename>diagnnose/models/wrappers/google_lm.py
import os
import sys
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch import Tensor
from diagnnose.models.recurrent_lm import RecurrentLM
from diagnnose.tokenizer import create_char_vocab
from diagnnose.tokenizer.... | StarcoderdataPython |
4996121 | from ..problem import problem
import numpy as np
class sinusoid(problem):
def __init__(self, initialState_list, targetGate=lambda x: np.sin(x)**2, configPath='./problems/hadamard/hadamard_config.yaml', verbose=2):
problem.__init__(self, testState_list=[lambda x: np.sin(x)**2], testGate=lambda x: -np.sin(x)... | StarcoderdataPython |
6502805 | <reponame>sbrunato/eodag
# -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, https://www.csgroup.eu/
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | StarcoderdataPython |
110955 | <filename>tripleohelper/provisioners/openstack/utils.py<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Red Hat, 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://ww... | StarcoderdataPython |
242702 | <gh_stars>1-10
from .BinBang import *
class RawWireCfg:
NA = 0x01
LSB = 0x02
_3WIRE = 0x04
OUTPUT = 0x08
class RawWire(BBIO):
def __init__(self, port, speed):
BBIO.__init__(self, port, speed)
def start_bit(self):
self.port.write("\x02")
self.timeout(0.1)
return self.response(1)
def stop_bit(self... | StarcoderdataPython |
5139978 | '''
Create a function sum_list_values that takes a list parameter and returns the sum of all the numeric values in the list.
Sample Data
joe 10 15 20 30 40
bill 23 16 19 22
sue 8 22 17 14 32 17 24 21 2 9 11 17
grace 12 28 21 45 26 10
john 14 32 25 16 89
'''
def sum_list_values(data_list):
index=1
sum_list=0... | StarcoderdataPython |
11307196 | n = int(input('Informe quantos elementos deseja: '))
c = 0
actual = 1
anterior =0
print('0; 1', end = '; ')
while c < n:
proximo = actual + anterior
print(proximo, end = '; ')
anterior = actual
actual = proximo
c+=1
print('FIM') | StarcoderdataPython |
1939087 | <filename>pycharm2020.1.3/script/core/common/EntityFactory.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
管理所有的Entity创建的工厂类
"""
from ..mobilelog.LogManager import LogManager
# from Md5OrIndexCodec import Md5OrIndexDecoder
# from mobilecommon import extendabletype
# from RpcIndex import RpcIndexer
from ..util.UtilApi... | StarcoderdataPython |
4873107 | <reponame>murrple-1/rss_temple
import datetime
import logging
from django.http import HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseNotFound
from django.db import transaction
from django.conf import settings
from django.dispatch import receiver
from django.core.signal... | StarcoderdataPython |
3478680 | # test-script for QUTest unit testing harness
# see https://www.state-machine.com/qtools/qutest.html
# preamble...
def on_setup():
expect("@timestamp FIXTURE_SETUP")
def on_teardown():
expect("@timestamp FIXTURE_TEARDOWN")
# tests...
test("FP output")
command("COMMAND_Z", 0, 3, 7)
expect("@timestamp COMMAND_... | StarcoderdataPython |
4800921 | from .clients import CharityClient, ApiKeyClient
from .helpers import InvalidAPIVersionError
DEFAULT_BASE_URL = "https://charitybase.uk/api"
DEFAULT_API_VERSION = 'v4.0.0'
SUPPORTED_API_RANGES = [
"v4.0.x"
]
class CharityBase:
def __init__(self, apiKey, baseUrl=None):
self.config = {
"api... | StarcoderdataPython |
3267192 | <gh_stars>10-100
from setuptools import setup
setup(name='noisemix',
version='0.1',
description='NoiseMix is a library for data generation for text datasets.',
url='https://gitlab.com/hetazotutyun/NoiseMix',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['no... | StarcoderdataPython |
3328244 | <reponame>DongjaeJang/Deep-Knowledge-Tracing
import torch.nn as nn
import torch
import torch.nn.functional as F
def get_criterion(pred, target, args):
loss = nn.BCELoss(reduction="none")
if args.loss == 'both' and args.epoch > 0:
bce_loss = loss(pred, target)
bce_loss = bce_loss[:,-1]
b... | StarcoderdataPython |
6424540 | <filename>source/api/app.py
"""
Hosts the main application, routing endpoints to their desired controller.
@author: <NAME>
@revision: v1.4
"""
from os import getenv as env
from flask import Flask, render_template, request
from werkzeug.exceptions import HTTPException
from models import BaseModel
from controllers impor... | StarcoderdataPython |
3561870 | #!/usr/bin/env python
import fvm
import fvm.fvmparallel as fvmparallel
import time
from numpy import *
from mpi4py import MPI
from FluentCase import FluentCase
fileBase = None
numIterations = 10
fileBase = "/home/yildirim/memosa/src/fvm/test/cav_44_tri"
#fileBase = "/home/yildirim/memosa/src/fvm/test/test_tri_500by5... | StarcoderdataPython |
332578 | <filename>Bite 37. Rewrite a for loop using recursion.py
"""Although you have to be careful using recursion it is one of those concepts you want to at least understand. It's also commonly used in coding interviews :)
In this beginner Bite we let you rewrite a simple countdown for loop using recursion. See countdown_fo... | StarcoderdataPython |
9756633 | import mne
import numpy as np
import pandas as pd
import logging
logger = logging.getLogger("mne")
logger.setLevel(logging.ERROR)
def process_resmed(file_path: str, station: str) -> pd.DataFrame:
"""process resmed files
Args:
file_path (str): path of the edf files
station (str): station
... | StarcoderdataPython |
122870 | import os
import sqlite3
from flask import current_app, g
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATABASE = os.path.join(BASE_DIR, "data/database.db")
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
return db
def close_c... | StarcoderdataPython |
4968119 | # -*- coding: utf-8 -*-
"""Views that trigger notifications or alerts via RapidPro."""
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.utils.timezone import now
from django.conf import settings
from mspray.apps.alerts.tasks import (
health_facility_catchment_... | StarcoderdataPython |
12828925 | <gh_stars>1-10
import statistics
import pytest
from telliot_feed_examples.feeds.eth_jpy_feed import eth_jpy_median_feed
@pytest.mark.asyncio
async def test_AssetPriceFeed():
"""Retrieve median ETH/JPY price."""
v, _ = await eth_jpy_median_feed.source.fetch_new_datapoint()
assert v is not None
asser... | StarcoderdataPython |
3334049 | <reponame>ckjh/shopping
# Generated by Django 2.2.2 on 2019-09-03 16:22
import admin01.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_depend... | StarcoderdataPython |
4924731 | <filename>Chapter03/phrases.py
import nltk
import string
import csv
import json
import pandas as pd
import gensim
from langdetect import detect
import pickle
from nltk import FreqDist
from Chapter01.dividing_into_sentences import divide_into_sentences_nltk
from Chapter01.tokenization import tokenize_nltk
from Chapter01... | StarcoderdataPython |
4996936 | <reponame>udhayprakash/Django_Projects<filename>DjangoTraining/IPLcricket/matches/management/commands/load_data.py
#!/usr/bin/python
"""
Purpose:
"""
from django.core.management.base import BaseCommand
import os
import csv
from IPLcricket import settings
from matches.models import MatchesPlayed, Deliveries
from datetim... | StarcoderdataPython |
3351096 | <gh_stars>10-100
import qq
class MyClient(qq.Client):
async def on_ready(self):
print(f'以 {self.user} 身份登录(ID:{self.user.id})')
print('------')
async def on_member_join(self, member: qq.Member):
channel = member.guild.get_channel(114514)
if channel is None:
channel... | StarcoderdataPython |
159090 | import numpy as np
import pandas as pd
import itertools
import matplotlib.pyplot as plt
from sklearn.model_selection import cross_val_predict,cross_val_score,train_test_split
from sklearn.metrics import classification_report,confusion_matrix,roc_curve,auc,precision_recall_curve,roc_curve
import pickle
#raw_df = pd.r... | StarcoderdataPython |
9697003 | <filename>Secao5_EstruturaLog&Cond/Exercicios/Exerc.1.py
"""
Faça um programa que receba dois numeros e mostre qual deles é maior.
"""
num = input('Digite o 1° numero: ')
num2 = input('Digite o 2° numero: ')
if num < num2:
print(f'{num2} é o número maior!')
else:
print(f'{num} é o maior número!')
| StarcoderdataPython |
8090682 | <filename>PyGame/Player/src/handler.py
import pygame
class Handler:
def __init__(self, player, buttons):
self.player = player
self.buttons = buttons
def mouse_events(self, event):
if event.button == 1:
for button in self.buttons:
button.try_action(event.pos... | StarcoderdataPython |
6625313 | <reponame>GrapeBaBa/ibis
import ibis
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import ibis.expr.types as ir
from ibis.tests.util import assert_equal, assert_pickle_roundtrip
def test_ifelse(table):
bools = table.g.isnull()
result = bools.ifelse("foo", "bar")
assert isinstance(res... | StarcoderdataPython |
4855404 | <filename>src/eddington_matplotlib/data.py
"""Plot fitting data."""
from eddington import FitData
from eddington_matplotlib.plot_configuration import PlotConfiguration
from eddington_matplotlib.util import (
get_figure,
errorbar,
)
def plot_data(data: FitData, plot_configuration: PlotConfiguration):
"""
... | StarcoderdataPython |
12848071 | # pylint: skip-file
import random
import string
from .common import * # noqa
# we don't use user sessions, so it doesn't matter if we recreate the secret key on each startup
SECRET_KEY = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(30))
# disable databases for the worker
DATABASES =... | StarcoderdataPython |
9650835 | <gh_stars>1-10
import warnings
import unittest
import rupee.engine
class _Base(object):
cache = None
data = {
'int': 123,
'string': 'foo',
'list': [1, 2, 3],
'dict': {'foo': 'bar', 'baz': 5}
}
def setUp(self):
self.cache.delete_all_data()
warnings.simp... | StarcoderdataPython |
6430965 | #!/usr/bin/env python
import pika
from pika import spec
import sys
import subprocess
import requests
import json
def get_node_ip(node_name):
bash_command = "bash ../cluster/get-node-ip.sh " + node_name
process = subprocess.Popen(bash_command.split(), stdout=subprocess.PIPE)
output, error = process.communic... | StarcoderdataPython |
364809 | <filename>apps/infra_gateway/functions.py
import random
import string
import requests
from django.conf import settings
from apps.challenge.models import Match, Map
def random_token():
chars = string.ascii_letters + string.digits
return ''.join((random.choice(chars)) for i in range(15))
def upload_code(sub... | StarcoderdataPython |
4847283 | <filename>wtypes/python_types.py
import sys
import typing
import wtypes
class _NoType:
...
class _ForwardSchema(wtypes.base._ContextMeta):
"""A forward reference to an object, the object must exist in sys.modules.
Notes
-----
Python types live on the __annotations__ attribute.
"""
_type... | StarcoderdataPython |
6501304 | <filename>tf-mnist/mnist_model.py
# Copyright 2016 The TensorFlow Authors. 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/LICENS... | StarcoderdataPython |
4915662 | <filename>pygears/typing/number.py
from .base import GenericMeta
from abc import ABCMeta, abstractmethod
class NumberType(ABCMeta, GenericMeta):
@property
@abstractmethod
def signed(self) -> bool:
...
class Number(metaclass=NumberType):
"""All numbers inherit from this class.
If you just... | StarcoderdataPython |
9697154 | import bpy
from bpy.props import *
from ...nodes.BASE.node_base import RenderNodeBase
# from ...utility import source_attr
from mathutils import Color, Vector
def update_node(self, context):
self.execute_tree()
class RenderNodeMaterialInput(RenderNodeBase):
bl_idname = 'RenderNodeMaterialInput'
bl_label... | StarcoderdataPython |
326876 | # Generated by Django 3.0.3 on 2020-05-09 11:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('techbeauty', '0005_addproduct'),
]
operations = [
migrations.CreateModel(
name='AddService',
fields=[
... | StarcoderdataPython |
11291991 | <gh_stars>0
#for non-overlapping substring you can simply count the number of occurances using:
#string.count(substring, start(optional), end(optional)
#for overlapping substring:
def overlapCount(string, sub_string):
count = 0
string_len = len(string)
sub_string_len = len(sub_string)
for i in range(string... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.