id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
10145 | EMAIL_AND_FAX_FORM_CONSTANTS = {
} | StarcoderdataPython |
3359439 | from django.shortcuts import render
from django.http import HttpResponse,Http404
from .models import Image
from django.core.exceptions import ObjectDoesNotExist
# Create your views here.
def start(request):
pictures = Image.objects.all()
return render(request,'start.html',{"pictures":pictures})
def search_res... | StarcoderdataPython |
39874 | '''
Wrapper module around `sklearn.mixture`
'''
__author__ = '<NAME>'
from .base_sklearn_classifier import SklearnClassifier
from simpleml.models.classifiers.external_models import ClassificationExternalModelMixin
from sklearn.mixture import BayesianGaussianMixture, GaussianMixture
'''
Gaussian Mixture
'''
class... | StarcoderdataPython |
3243 | <reponame>chetanya-shrimali/scancode-toolkit<filename>src/licensedcode/tokenize.py
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data ge... | StarcoderdataPython |
97875 | <gh_stars>1-10
prime_numbers = [True for x in range(1001)]
prime_numbers[1] = False
for i in range(2, 1001):
for j in range(2*i, 1001, i):
prime_numbers[j] = False
input()
count = 0
for i in map(int, input().split()):
if prime_numbers[i] is True:
count += 1
print(count)
| StarcoderdataPython |
3348487 | <reponame>rvprasad/software-testing-course<filename>homework/Testing with Properties (Queue)/impl_fail-queue_unsuccessful_dequeue_returns_zero.py
import math
class Queue(object):
def __init__(self):
self.__values = []
self.__len = 0
def enqueue(self, v):
if v == None or (isinstance(v, ... | StarcoderdataPython |
1623266 | from typing import Sequence
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.db.models.enums import TextChoices
from . import models
class create_course_form(forms.Form):
title = forms.CharField(label='موضوع:',
widget=fo... | StarcoderdataPython |
56254 | <filename>ploader/utils.py
import subprocess, os, os.path, yaml, shlex, re, urllib.parse, shutil, urllib.request, threading
def exe(cmd):
if type(cmd) != type([]):
cmd = shlex.split(cmd)
return subprocess.Popen(cmd)
def exe_pipes(cmd):
if type(cmd) != type([]):
cmd = shlex.split(cmd)
return subprocess.Popen(c... | StarcoderdataPython |
167408 | def random_seed(len: int) -> str:
from lunespy.wallet.constants import word_list
from os import urandom
def f():
word_count = 2048
r: bytes = urandom(4)
x: int = r[3] + (r[2] << 8) + (r[1] << 16) + (r[0] << 24)
w1: int = x % word_count
w2: int = ((int(x / word_count)... | StarcoderdataPython |
188589 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_recoverstats.py
#
# Copyright 2016 <NAME> <<EMAIL>>
#
import os
import shlex
import subprocess
import sys
sys.path.insert(0, os.path.abspath('..'))
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import stats
import sep
from astropy.convol... | StarcoderdataPython |
4818511 | from .diagram_core.system import System
from .diagram_core import datatypes as dt
from .diagram_core.signal_network.signals import Signal
from .diagram_core import code_generation_helper as cgh
from . import block_interface as bi
from typing import Dict, List
class SystemWrapper:
def __init__(self, system : S... | StarcoderdataPython |
1796819 | <gh_stars>0
#!/usr/bin/python
"""
Splits the total fileset and creates condor job submission files for the specified run script.
Author(s): <NAME>
"""
import argparse
import os
from math import ceil
from string import Template
import json
def get_fileset(year, samples, subsamples):
with open(f"data/pfnanoindex... | StarcoderdataPython |
82123 | import re
import datetime
from Constants import *
from ..Hashes import *
from StringUtils import *
from TimeZoneUtils import *
from ..ScheduleEvent import *
from .Scraper import *
def SupplementSchedule(sched, navigator, sport, league, season):
supplement = ScrapeAllStarGame(sport, league, seas... | StarcoderdataPython |
4811399 | class Solution:
def removeNthFromEnd(self, head, n):
dummy = ListNode(-1)
dummy.next = head
back = dummy
front = dummy
for i in range(n):
front = front.next
while front.next != None:
front = front.next
back = back.next
... | StarcoderdataPython |
1767221 | """
Implements the Scalyr Agent 2 application as well as provide support for constructing Monitor Plugins.
Scalyr Agent 2 is a daemon process run on Scalyr customer's machines to collect metrics and logs and send them
to the Scalyr servers for indexing and analysis. Which logs are sent are set via a configuration fil... | StarcoderdataPython |
1632910 | from tqdm import tqdm
tqdm.pandas()
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import confusion_matrix
from .TextProcess import text_tokens
from xin_util.Scores import single_label_f_score
from sklearn.model_selection ... | StarcoderdataPython |
1727490 | <reponame>enbyte/BTM<gh_stars>0
VERSION = '0.1.3'
print("BTM version %s\nContributors welcome! https://github.com/enbyte/btm" % VERSION)
from .btm import *
| StarcoderdataPython |
1691461 | <reponame>JARVIS-AI/CBBI<filename>metrics/stock_to_flow.py
from datetime import timedelta
from typing import List
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from utils import add_common_markers
from .base_metric import BaseMetric
class StockToFlowMetric(BaseMet... | StarcoderdataPython |
1645467 | <gh_stars>0
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2022 appliedAIstudio LLC"
__version__ = "0.0.1"
# AI, GOAP
# needed to copy the intended effects into the actual effects
import copy
# needed to keep the action alive in its thread
import time
# defines action status
from enum import Enum
from threading... | StarcoderdataPython |
1651574 | <reponame>IUS-CS/BearsOnUnicycles
from .. import game_object
from .. import component
from unittest import TestCase
class TestGameObject(TestCase):
def test_set_active_True(self):
g = game_object.GameObject("Test")
g.set_active(True)
assert g.active
def test_set_active_False(self):
... | StarcoderdataPython |
4805225 | # ------------------------------------------------------------------------------
# CodeHawk C Source Code Analyzer
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2017-2020 Kestrel Technology LLC
#
# Permission is hereby granted... | StarcoderdataPython |
3340650 | import sys
import PyPluMA
class UnclassifiedListPlugin:
def input(self, filename):
self.kronafiles = []
myfile = open(filename, 'r')
for line in myfile:
self.kronafiles.append(line.strip())
def run(self):
self.unclass = set()
for mydir in self.kronafiles:
... | StarcoderdataPython |
1792178 | <filename>config.py
try:
import configparser as cp
except ImportError:
import ConfigParser as cp
config = cp.RawConfigParser()
try: #python2
config.read('config')
except UnicodeDecodeError:
config.read('config',encoding='utf-8')
def ConfigSectionMap(section):
dict1 = {}
options = config.optio... | StarcoderdataPython |
180107 | <reponame>eltonfss/TMDLibrary
from experiments.tmd_experiment_base import TMDExperiment
from os import path
from detectors.ab_tmd import AdaBoostTMD
experiment = TMDExperiment(
experiment_path=path.abspath(path.dirname(__file__)),
detector_type=AdaBoostTMD
)
experiment.run()
| StarcoderdataPython |
3377630 | import pygame
pygame.init()
imgBck = pygame.image.load('img/bck.png')
imBx, imBy = imgBck.get_size()
display_width = imBx
display_height = imBy
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('A bit Racey')
black = (0,0,0)
white = (255,255,255)
clock = pygame.tim... | StarcoderdataPython |
3307666 | <gh_stars>1-10
import random
from typing import Optional, Protocol
import attr
import trio
from attr import attrib, attrs
from rich.live import Live
from rich.table import Table
from rich.text import Text
from trio import open_memory_channel
from trio_vis import SC_Monitor, VisConfig
NM_LOGS_SHOWN = 8
class Connec... | StarcoderdataPython |
3240832 | from django import forms
from .models import Usert
from django.contrib.auth.hashers import check_password
class LoginForm(forms.Form):
username = forms.CharField(
error_messages={"required": "아이디를 입력해주세요."}, max_length=32, label="사용자 이름"
)
password = forms.CharField(
error_messages={"requi... | StarcoderdataPython |
110309 | from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from osmaxx.excerptexport.models import Export
def tracker(request, export_id):
export = get_object_or_404(Export, pk=export_id)
export.set_and_handle_new_status(request.GET['status'], incoming_request=request)
response ... | StarcoderdataPython |
139768 | # coding=utf-8
import os
__author__ = 'zephor'
ROOT = os.path.abspath(os.path.dirname(__file__))
DATA_RAW = os.path.join(ROOT, 'data_raw/')
DATA_PREPROCESSED = os.path.join(ROOT, 'data_prep/')
DATA_NAMED = os.path.join(ROOT, 'data_named/')
| StarcoderdataPython |
194889 | import numpy
import pint.compat
from openff.evaluator import unit
class ParameterGradientKey:
@property
def tag(self):
return self._tag
@property
def smirks(self):
return self._smirks
@property
def attribute(self):
return self._attribute
def __init__(self, tag=N... | StarcoderdataPython |
75093 | from microbit import *
import random
BULLET_SPEED = 3
PLAYER_SPEED = 2
UFO_SPEED = 15
game_go = True
score = 0
class Player:
def __init__(self):
self.x = 2
self.y = 4
display.set_pixel(self.x, self.y, 9)
def move(self, dx):
display.set_pixel(self.x, 4, 0)
self.x += dx
... | StarcoderdataPython |
1737586 | <reponame>ihgazni2/navegador5
import urllib.parse
import os
import re
from xdict import utils
import elist.elist as elel
def get_origin(url):
rslt = urllib.parse.urlparse(url)
origin = rslt.scheme +'://'+rslt.netloc
return(origin)
def get_base_url(url):
temp = urllib.parse.urlparse... | StarcoderdataPython |
3304950 | from .controller_node import ControllerNode
from .vel_parser_node import VelParserNode
| StarcoderdataPython |
143456 | <filename>pydantic_pandas/core.py
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['DataFrame', 'BaseModel', 'BaseFrame']
# Internal Cell
from pandas.core.frame import DataFrame as PandasDataFrame
from pydantic import (
validator,
root_validator
)
from pydant... | StarcoderdataPython |
4339 | # Copyright (c) 2006- Facebook
# Distributed under the Thrift Software License
#
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
class TType:
STOP = 0
VOID = 1
BOOL = 2
BYTE = 3
I08 = 3
DOUBLE = 4
I16 = 6
I32 = 8
I64 = 10
STR... | StarcoderdataPython |
23451 | import matplotlib.pyplt as plt
from bermuda import ellipse, polygon, rectangle
plt.plot([1,2,3], [2,3,4])
ax = plg.gca()
# default choices for everything
e = ellipse(ax)
# custom position, genric interface for all shapes
e = ellipse(ax, bbox = (x, y, w, h, theta))
e = ellipse(ax, cen=(x, y), width=w, height=h, the... | StarcoderdataPython |
190249 | from collections import defaultdict
from typing import Dict, List, Optional, Type
from nuplan.common.maps.maps_datatypes import TrafficLightStatusData, TrafficLightStatusType
from nuplan.planning.scenario_builder.abstract_scenario import AbstractScenario
from nuplan.planning.simulation.history.simulation_history_buffe... | StarcoderdataPython |
1738461 | <reponame>quchunguang/test<filename>testpy/testpyglet.py
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import pyglet
from pyglet.gl import *
win = pyglet.window.Window()
@win.event
def on_draw():
# Clear buffers
glClear(GL_COLOR_BUFFER_BIT)
# Draw outlines only
glPolygonMode(GL_FRONT_AND_BACK, GL_LI... | StarcoderdataPython |
3362253 | <filename>deepstack_sdk/config.py
class ServerConfig(object):
def __init__(self,server_url: str,api_key: str=None,admin_key: str=None):
self.server_url = server_url
if not self.server_url.endswith("/"):
self.server_url = self.server_url+"/"
self.api_key = api_key
self.adm... | StarcoderdataPython |
1691418 | """
Handlers required by the core chain operations
"""
import json
from time import sleep, time
from tornado import escape
from yadacoin.http.base import BaseHandler
from yadacoin.core.common import ts_to_utc
from yadacoin.core.chain import CHAIN
from yadacoin.core.transaction import Transaction
class GetLatestBloc... | StarcoderdataPython |
1754098 | <reponame>JoseArtur/phyton-exercices<filename>PyUdemy/Day14/test.py
b=0
def add(a,b):
b+=1
return
print(add(1,b)) | StarcoderdataPython |
3384687 | # Computes the change (in percent) in confidence level for a group of base and alternative
# predictions.
def confidence_change(conf, alt_conf):
return (abs(conf - alt_conf) / conf) * 100.0
# Computes the misclassification rate for a group of base and alternative predictions. For details,
# check: Narodytska, Nin... | StarcoderdataPython |
3294472 | <reponame>scorphus/holmes-api<filename>holmes/migrations/versions/2932df901655_removing_settings_table.py
"""Removing settings table
Revision ID: 2932df901655
Revises: <PASSWORD>
Create Date: 2014-04-03 10:45:09.592592
"""
# revision identifiers, used by Alembic.
revision = '2932df901655'
down_revision = '<PASSWORD>... | StarcoderdataPython |
3248289 | import sqlite3
import os
obf_type_file = open("data/obf/il2cpp-types.h", "r")
obf_ptr_file = open("data/obf/il2cpp-types-ptr.h", "r")
conn = sqlite3.connect('tmp/obf_structs.db')
c = conn.cursor()
c.execute('''CREATE TABLE symbols (name text, fields text, staticfields text, class text, vtable text)''')
for i in obf_p... | StarcoderdataPython |
4834555 | <filename>dependencies/panda/direct/controls/InputState.py
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from direct.showbase.PythonUtil import SerialNumGen
# internal class, don't create these on your own
class InputStateToken:
_SerialGen = SerialNumGen()
Inval = ... | StarcoderdataPython |
31842 | <filename>src/python/pants/backend/core/tasks/scm_publish.py<gh_stars>10-100
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
... | StarcoderdataPython |
138155 | import threading
from tempus.edge.proto import TrackConfig_pb2 as TC
config_lock = threading.Lock()
CONFIG_PATH="/mnt/config/config.pb"
tc = TC.TrackConfig()
def updateTrackConfig():
try:
with config_lock:
tc.Clear()
tc.ParseFromString(open(CONFIG_PATH, "rb").read())
print("succesfully updated... | StarcoderdataPython |
193540 | <reponame>glstr/python_learning<filename>digram/diagram.py
#!/usr/bin/python
#coding=utf-8
import numpy as np
import matplotlib.pyplot as plt
# evenly sampled time at 200ms intervals
t = np.arange(0., 5., 0.2)
# red dashes, blue squares and green triangles
plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
plt.show... | StarcoderdataPython |
1704945 | from .responder import Responder, ResponderType
from pepper.framework import *
from pepper.language import Utterance
from pepper.knowledge import animations
from random import choice
from typing import Optional, Union, Tuple, Callable
class BrexitResponder(Responder):
@property
def type(self):
retu... | StarcoderdataPython |
1687468 | """Test insteonplm LinkedDevices Class."""
from insteonplm.address import Address
from insteonplm.linkedDevices import LinkedDevices
from insteonplm.devices.switchedLightingControl import SwitchedLightingControl
from .mockPLM import MockPLM
def test_create_device_from_category():
"""Test device created from cateo... | StarcoderdataPython |
148032 | <gh_stars>0
max_size = 10
print(
"(a)" + " " * (max_size) +
"(b)" + " " * (max_size) +
"(c)" + " " * (max_size) +
"(d)" + " " * (max_size)
)
for i in range(1, max_size + 1):
print("*" * i, end = " " * (max_size - i + 3))
print("*" * (max_size - i + 1), end = " " * (i - 1 + 3))
print... | StarcoderdataPython |
100018 | <filename>vex_via_wrapper.py<gh_stars>1-10
import requests
MATCH_LIST_URL = "http://data.vexvia.dwabtech.net/mobile/events/csv"
DIVISION_URL = "http://data.vexvia.dwabtech.net/mobile/{}/divisions/csv"
MATCH_URL = "http://data.vexvia.dwabtech.net/mobile/{}/{}/matches/csv"
def get_events(is_iq: bool=False) -> list:
... | StarcoderdataPython |
1749159 | <reponame>Cluckerino/code-katas-python
"""Example unit test module"""
import unittest
import solutions.hello_world
class HelloWorldTest(unittest.TestCase):
"""Example test suite"""
def test_hello_world(self):
"""Example unit test"""
self.assertEqual("Hello World!", solutions.hello_world.hell... | StarcoderdataPython |
1621334 | from app import app
import urllib.request,json
from .models import news
from .models.sources import Sources
News = news.News
api_key = app.config['NEWS_API_KEY']
base_url = app.config['HEADLINES_BASE_URL']
search_api = app.config["SEARCH_API"]
sources_api = app.config["SOURCES_BASE_URL"]
source_articles_api = app.co... | StarcoderdataPython |
32930 | <reponame>emmilinuxorg/emmi-aplicativos<filename>usr/lib/tuquito/tuquito-software-manager/widgets/pathbar2.py
# Copyright (C) 2009 <NAME>
#
# Authors:
# <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Sof... | StarcoderdataPython |
59667 | import numpy as np
from wholeslidedata.annotation.structures import Point
from wholeslidedata.annotation.wholeslideannotation import WholeSlideAnnotation
from wholeslidedata.image.wholeslideimage import WholeSlideImage
from wholeslidedata.labels import Label
def non_max_suppression_fast(boxes, overlapThresh):
"""... | StarcoderdataPython |
4818335 | <gh_stars>0
import numpy as np
import theano
import theano.tensor as T
def floatX(arr):
"""
Shortcut to turn a numpy array into an array with the
correct dtype for Theano.
"""
return arr.astype(theano.config.floatX)
def shared_empty(dim=2, dtype=None):
"""
Shortcut to create an empty Th... | StarcoderdataPython |
4806779 | from scrapy import Spider
import scrapy
from jdScrapy.items import JdscrapyItem
from scrapy import Selector
class jingdongspider(scrapy.Spider):
name = 'jd'
def __init__(self):
super().__init__()
self.start_urls = [
'https://list.jd.com/list.html?cat=670,677,679' # 3个数字分别指代电脑办公、电... | StarcoderdataPython |
4836873 | <reponame>L-Net-1992/Paddle
# Copyright (c) 2021 PaddlePaddle 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/LICENSE-2.0
... | StarcoderdataPython |
3389663 | units = 'amu'
physical = {
"H" : 1.008,
"He" : 4.002602,
"Li" : 6.94,
"Be" : 9.0121831,
"B" : 10.81,
"C" : 12.011,
"N" : 14.007,
"O" : 15.999,
"F" : 18.998403163,
"Ne" : 20.1797,
"Na" : 22.98976928,
"Mg" : 24.305,
"Al" : 26.9815385,
"Si" : 28.085,
"P" : 30.973761998,
"S" : 32.06,
"Cl" : 35.45,
"Ar" :... | StarcoderdataPython |
1623465 | <filename>examples/quickstart.py
# 密钥可在https://console.ucloud.cn/uapi/apikey中获取
public_key = '' #账户公钥
private_key = '' #账户私钥
bucket = '' #空间名称
local_file = '' #本地文件名
put_key = '' #上传文件在空间中的名称
save_file = '' #下载文件保存的文件名
from ufile imp... | StarcoderdataPython |
137202 | # Copyright (c) 2017, <NAME>
import markdown
from handroll.composers.generic import GenericHTMLComposer
class MarkdownComposer(GenericHTMLComposer):
"""Compose HTML from Markdown files (``.md``).
The first line of the file will be used as the ``title`` data for the
template. All following lines will be... | StarcoderdataPython |
3377436 | import os, discord, random, time, sys, asyncio
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client()
@client.event
async def on_ready():
guild = discord.utils.get(client.guilds, name=GUILD)
print(
f'{client.user} ... | StarcoderdataPython |
1748142 | #imports
import discord
from discord.ext import commands,tasks
import os
import traceback
import random
import re
import time
import datetime
from datetime import timedelta,timezone
import json
import requests
import math
Channel_ID1 = 886972852979531786 #その他ログ
Channel_ID2 = 867042310180962315 #注意ユーザーリスト
Channel_ID3... | StarcoderdataPython |
3293663 | <filename>charms/kubernetes-dashboard/tests/unit/test_charm.py
import pytest
from ops.model import ActiveStatus, BlockedStatus, WaitingStatus
from ops.testing import Harness
import yaml
from charm import K8sDashboardCharm
if yaml.__with_libyaml__:
_DefaultDumper = yaml.CSafeDumper
else:
_DefaultDumper = yam... | StarcoderdataPython |
66385 | <reponame>arnoyu-hub/COMP0016miemie
from pandas.io.sas.sasreader import read_sas # noqa
| StarcoderdataPython |
4842728 | from trainer.config import config
config.is_test = True
config.epochs = 1
def test_graybox_e2e():
from trainer import graybox_task
def test_blackbox_e2e():
from trainer import blackbox_task
| StarcoderdataPython |
1793169 | from celery.bin.beat import beat
from tasks import app
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
app.config_from_object('config')
# @app.on_after_configure.connect
# def setup_periodic_tasks(**kwargs):
# kwargs['sender'].add_periodic_task(10.0, ping.s(), name='ping every 10')... | StarcoderdataPython |
1780886 | import numpy as np
from GPy.core import SparseGP
from GPy.likelihoods import Gaussian
from GPy.inference.latent_function_inference import VarDTC
from paramz.transformations import Logexp
from GPy.core.parameterization import Param
from kb_learning.kernel import KilobotEnvKernel
import logging
logger = logging.getLogg... | StarcoderdataPython |
1659829 | <reponame>syntx/yad2pynotify<gh_stars>1-10
import logging
from splinter import Browser
from notify import send_notification
from time import sleep
WAIT_BETWEEN_TASKS = 10
def visit_all_tasks(config, db):
browser = None
for task in config.get('tasks', []):
if browser:
logging.info('Waiting... | StarcoderdataPython |
140798 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import commonlibs.math.interpolation as m
def test_lin_interpol():
"""
Test function for linear interpolation
"""
x12 = (0, 10)
y12 = (20, 40)
assert m.lin_interpol(y12=y12, x12=x12, x=5) == 30
x12 = (0, 1)
y12 = (0, 1)
... | StarcoderdataPython |
1758590 | <reponame>KarynaTaranova/dusty<filename>dusty/data_model/npm/parser.py
# Copyright 2018 getcarrier.io
#
# 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/l... | StarcoderdataPython |
153119 | <filename>api/elastic_connection.py
from elasticsearch import Elasticsearch
from config.config_handling import get_config_value
def connect_elasticsearch(**kwargs):
_es_config = get_config_value('elastic', 'es_host')
_es_hosts = [_es_config]
_es_username= get_config_value('elasticusername', 'es_username')... | StarcoderdataPython |
1618278 | <filename>tests/test_branch_rename.py<gh_stars>1-10
from unittest.mock import Mock
class StubClient():
org_name = 'dummy_org'
team = 'dummy_team'
token = <PASSWORD>'
github = {
'repository': Mock()
}
class StubRepoSameBranch():
def __init__(self, expected_branch):
self.defau... | StarcoderdataPython |
157448 | class Renderer(object):
def __init__(self, dimentions, resolution, robot):
self.viewer = None
self.margin = 0.2
screen_size = 600
self.SKIP_RENDER = 20
self.resolution = resolution
self.robot = robot
world_width_x = dimentions[0]*self.resolution + self.margin... | StarcoderdataPython |
3295702 | import sys
import os
from glob import glob
import pickle
import configparser
import logging
import logging.config
from tzlocal import get_localzone
from pytz import timezone
from pytz.exceptions import UnknownTimeZoneError
from tablo.api import Api
logger = logging.getLogger(__name__)
# For batch Api call
MAX_BATCH = ... | StarcoderdataPython |
1775171 | <reponame>shyaman/aries_v4-quadruped<filename>Rotate.py<gh_stars>1-10
from LegsControl import *
def RotateRight(front_left, front_right, rear_left, rear_right):
front_left_r = Process(target=frontLeg,args=(front_left,))
rear_right_r = Process(target=rearLeg,args=(rear_right,))
upLegs = Process(target=legs... | StarcoderdataPython |
3364952 | # Copyright (c) 2020 NVIDIA CORPORATION.
# Copyright (c) 2018-2020 <NAME> (<EMAIL>).
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the ri... | StarcoderdataPython |
59032 | <reponame>wuwuwuyuanhang/python<gh_stars>1-10
'''
@Author: wuwuwu
@Date: 2019-10-20 19:41:29
@LastEditors: wuwuwu
@LastEditTime: 2019-10-20 19:48:45
@Description: 最大池化
'''
import cv2 as cv
import numpy as np
def maxPooling(img, kernel_size=3):
"""
最大池化,在kernel_size*kernel_size范围内的像素最大值为该区域像素
:param img: 输... | StarcoderdataPython |
1651122 | import discord
from discord.ext import commands
import requests
import json
import random
import sys
sys.path.insert(1, '/pyfiles')
from pyfiles import reddit
from discord.utils import get
class Fun(commands.Cog, name="Fun"):
def __init__(self, client):
self.client = client
@commands.command()
a... | StarcoderdataPython |
21603 | <gh_stars>1-10
"""test_example
.. codeauthor:: <NAME> <<EMAIL>>
"""
from flask import url_for
from eve import Eve
import pytest
@pytest.mark.example
def test_example(client: Eve):
"""Example test for reference
:param Eve client: Mockerena app instance
:raises: AssertionError
"""
res = client.... | StarcoderdataPython |
3398293 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace, dyndep
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
import hypothesis.strategies as st
import ... | StarcoderdataPython |
31201 | # Copyright 2014 <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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
3308540 | <gh_stars>1-10
def generate_line(char):
LINE_WIDTH = 60
return (char * LINE_WIDTH) + '\n'
| StarcoderdataPython |
8106 | import sys
import unittest
try:
from unittest import mock
except ImportError:
import mock
import argparse
from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser
from .common_setup import *
commandname = 'createsiteusers'
class CreateSiteUsersParserTest(unittest.TestCase):
@classmethod... | StarcoderdataPython |
3362292 | <reponame>knaruo/barracuda
"""Set Hole Positions for barracuda keyboard
Assumption: Please run cd to the script folder before run
this script by execfile()."""
import os
import pcbnew
# Constants
X_OFS = float(8.293)
Y_OFS = float(86.868 - 88.1)
ROT = -90 # degree
def set_diode_position_by_sw(pcb, sw_name):
... | StarcoderdataPython |
3251085 | <reponame>pywr/pywr-next<gh_stars>0
from .base import (
BaseParameter,
ConstantParameter,
AggregatedParameter,
ParameterRef,
ParameterCollection,
DataFrameParameter,
ControlCurvePiecewiseInterpolatedParameter,
)
from .control_curves import ControlCurveIndexParameter
from .profiles import Mon... | StarcoderdataPython |
1691970 | <gh_stars>1-10
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from twisted.internet.endpoints import serverFromString, clientFromString
from twisted.internet.protocol import Factory
from twisted.internet.task import LoopingCall
from twisted.internet.threads import deferToThread
fro... | StarcoderdataPython |
4836022 | <reponame>priyansh-1902/olympus
#!/usr/bin/env python
import numpy as np
from olympus.surfaces import AbstractSurface
from itertools import product
class Branin(AbstractSurface):
def __init__(self, noise=None):
"""Branin function.
Args:
param_dim (int): Number of input dimensions. D... | StarcoderdataPython |
3296358 | <filename>Algorithms/Graphs and Graph Algorithms/breadth-first-search/main.py
from graph import Graph
graph = Graph()
myVertices = ['A','B','C','D','E','F','G','H','I']
# add vertices
for i in range(len(myVertices)):
graph.addVertex(myVertices[i])
graph.addEdge('A', 'B')
graph.addEdge('A', 'C')
graph.addEdge('A'... | StarcoderdataPython |
1648548 | <filename>parameters.py
"""
Constant parameters used in the genetic algorithm and problem constraints
"""
# --- problem parameters
grid_size = 200
nb_cities = 50
# --- genetic algorithm parameters
# -> can be tweaked (almost) freely to study convergence speed and algorithm efficiency
rng_seed = 42
population_size = 1... | StarcoderdataPython |
83139 | <reponame>brendanartley/NHL-Event-Detection<gh_stars>0
import json, os
from datetime import datetime
from . import constants as c
from collections import namedtuple
MatchDigest = namedtuple("MatchDigest", ["game_id", "home_team_id", "away_team_id", "start_time", "end_time"])
def extract_match_info(linescore):
try... | StarcoderdataPython |
4831601 | # program r1_22.py
# Najprostszy sposób definiowania obiektu
class Paletka:
pass
paletka_a = Paletka()
print(f"Obiekt typu {type(paletka_a)} zawiera od razu pewne właściwości i metody:")
print(dir(paletka_a))
| StarcoderdataPython |
1646157 | #!/usr/bin/env python3
"""
Simple stub that calls the 'real' deploy.py in the git submodule without an
additional path prefix. Passes along any parameters without modification.
For usage, optional arguments, syntax, etc. please refer to the RoboLab Docs
which are accessible at https://robolab.inf.tu-dresden.de.
This ... | StarcoderdataPython |
158960 | <gh_stars>0
import os
import threading
import time
from battleship_client import BattleshipClient
from board import Board
grpc_host = os.getenv('GRPC_HOST', 'localhost')
grpc_port = os.getenv('GRPC_PORT', '50051')
playing = threading.Event()
playing.set()
battleship = BattleshipClient(grpc_host=grpc_host, grpc_port=... | StarcoderdataPython |
1769083 | <reponame>DoNnMyTh/ralph
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import ralph.lib.mixins.fields
class Migration(migrations.Migration):
dependencies = [
('tests', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
3210735 | <reponame>Priyalvora/pythonAss
# List
List = ['hey', 'how', 'are', 'you', 25]
List.remove('are')
List.insert(2, 'hey')
print(List)
List = [12, 23, 4, 21, 12, 21, 12]
print(sum(List))
print(List.count(12))
print(len(List))
print(List.index(4))
# Dictionary
dict= {"A": "Python", "B": "Python1", "C": "P... | StarcoderdataPython |
4810700 | <reponame>jasonb5/cdms<gh_stars>1-10
#!/usr/bin/env python
"""
A variable-like object extending over multiple tiles and time slices
<NAME> and <NAME>, Tech-X Corp. (2011)
This code is provided with the hope that it will be useful.
No guarantee is provided whatsoever. Use at your own risk.
"""
import cdms2
from cdms2.... | StarcoderdataPython |
153080 | from usl import EmployeeView
if __name__ == '__main__':
view=EmployeeView()
view.main()
| StarcoderdataPython |
3293317 | #!/usr/bin/env python3
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
import defopt
def plot_gamma_posterior(loc, scale, n_samples):
"""plot the posterior of the precision of the projection components"""
n_comps = len(loc)
samples = np.exp(np.random.ran... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.