id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4907621 | <filename>moonleap/utils/join.py
def join(prefix, infix, postfix=""):
if infix:
return prefix + infix + postfix
return infix
| StarcoderdataPython |
1811862 | <filename>index2.py
def add_task(any_list):
user_add_task = input("Enter a task you would like to add to the list: ")
any_list.append(user_add_task)
def delete_task(any_list):
user_del_task = input("Enter a task you would like to delete from the list: ")
if user_del_task in any_list:
del_index... | StarcoderdataPython |
101294 | import torch
import shutil
import numpy as np
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
# import cv2
from skimage.transform import resize
import torchvision.transforms as transforms
from sklearn.metrics import precision_score, recall_score, f1_score, roc_auc_score
class AverageMeter(obje... | StarcoderdataPython |
11332466 | """Adds user teams
Revision ID: <KEY>
Revises: 95d86da7b3c7
Create Date: 2020-08-19 14:20:57.539270
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "95d86da7b<PASSWORD>"
branch_labels = None
depends_on = None
def upgrade():
op.creat... | StarcoderdataPython |
9611175 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from django.views.generic import TemplateView
from . import views
app_name = 'oauth_clients'
urlpatterns = [
url(
regex="^Client/~create/$",
view=views.ClientCreateView.as_view(),
name='Client_create',
),
url(
regex=... | StarcoderdataPython |
3460483 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 22 13:05:13 2016
@author: chyam
"""
#import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sb
import analyticutils as au
import argparse
def main():
argparser = argparse.ArgumentParser(description='This script will perform simple data analysis o... | StarcoderdataPython |
364127 | # Date: 2020/11/05
# Author: <NAME>
# Description:
# ##
#
#
def square():
#DEFINING EPSILON (MARGIN OF ERROR)
epsilon = 0.01
#DEFINING STEP (HOW MUCH I CAN APPROXIMATE IN EACH STEP)
step = epsilon**2
#DEFINFING ANSWER
answer = 0.0
#DEFINING OBJECTIVE (TO CALCULATE SQUAR... | StarcoderdataPython |
362716 | #!/usr/bin/env python
# encoding: utf-8
"""
fields.py
Created by <NAME> on 2013-09-23.
Copyright (c) 2012 Multmeio [design+tecnologia]. All rights reserved.
"""
from django.db import models
from django_orm.postgresql.hstore import HStoreManager
from hstore_flattenfields.db.queryset import FlattenFieldsFilterQuerySet... | StarcoderdataPython |
6444923 | #1. 首先创建100个Dog, 50个SheepDog, 50个PoliceDog
#2. 每一轮游戏,随机选出2个Dog
#3. dog1先攻击dog2,然后dog2攻击dog1
#3. 任何一方血量变为0就表明死亡!死亡的Dog退出游戏。
#4. 最后只有一个Dog了,游戏结束,胜利者可以吃鸡。
from dog import *
import random #产生随机数字
import time #时间模块
#1.创建100条狗
for i in range(100):
if(i%2==0):
SheepDog(i+1) #创建1个牧羊犬
else:
PoliceDog(i+1) #创建1个警犬
#2. 开始... | StarcoderdataPython |
11355651 | <reponame>haibeey/doclite
import pydoclite #install pydoclite
import os,glob
def removeFiles():
for f in glob.glob("doclitetest.db*"):
try:
os.remove(f)
except OSError:
pass
removeFiles()
d = pydoclite.Doclite.Connect(b"doclitetest.db")
baseCollection ... | StarcoderdataPython |
3483467 | <gh_stars>1-10
import json, _jsonnet
with open('Tools/qns_gen/test.jsonnet') as f:
data = f.read()
data = _jsonnet.evaluate_snippet("snippet",data)
# print(data)
with open('Tools/qns_gen/_qns.json', 'w') as f : f.write(data) | StarcoderdataPython |
373700 | #!/usr/bin/python3
from datetime import datetime
now = datetime.now()
year = now.year
day_of_year = now.timetuple().tm_yday
hour = now.hour
minute = now.minute
second = now.second
one_hour = 1 / 24 / 365
one_minute = one_hour / 60
one_second = one_minute / 60
exact_day = (day_of_year / 365)
exact_hour = hour * one_... | StarcoderdataPython |
4908369 | import numpy as np
from gym import spaces
from ..miniworld import MiniWorldEnv, Room
from ..entity import Box, Agent
from ..params import DEFAULT_PARAMS
from ..math import *
import random
class HAWKMaze(MiniWorldEnv):
"""
HAWK-Maze zum Trainieren eines DDQ-Agents
"""
def __init__(self, **kwargs):
... | StarcoderdataPython |
4872355 | <reponame>Captmoonshot/pydango
#!/usr/bin/env python3
import argparse
from sqlalchemy import create_engine
from pydango import (
cinephile,
theater_owner,
cinephile_sqlite,
theater_owner_sqlite,
)
from pydango.primary_func import (
create_session,
create_sqlite_session,
insert_account_da... | StarcoderdataPython |
4960869 | <reponame>macodroid/strawberry_disease_classification
import os
import cv2
import numpy as np
import shutil
from bouding_box import get_all_points
from data_utils import separate_files
def extract_infected_area(image_name, json_file, path_to_file):
image = cv2.imread(f'{path_to_file}/{image_name}')
points = ... | StarcoderdataPython |
4943450 | <filename>codes/structure3D.py
#!/usr/local/bin/python
import re
f = open("structure3D.html", "w")
f1 = open('Conformer3D_CID_89594.sdf')
f2 = open('Conformer3D_CID_89594.sdf', encoding="utf-8")
f3 = open('Conformer3D_CID_89594.sdf', encoding="utf-8")
length = len(f3.readlines())
for j in range(length):
... | StarcoderdataPython |
6594901 | # coding:utf-8
import time
import json
import datetime
import tornado
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler
from tornado.websocket import WebSocketHandler
from tornado.concurrent import run_on_executor
from tornado import gen
from tornado.options import define, options, parse_comman... | StarcoderdataPython |
1935815 | <reponame>lel352/Curso-Python<filename>aulapythonpoo/exercicio02/app.py
from aulapythonpoo.exercicio02.classes.calcipv4 import CalcIPv4
def main():
""" Exemplos de Uso """
# Com prefixo
calc_ipv4_1 = CalcIPv4(ip='192.168.0.128', prefixo=30)
print(f'IP: {calc_ipv4_1.ip}')
print(f'Máscara: {calc_ip... | StarcoderdataPython |
1933404 | <reponame>StrayRobots/stray
import numpy as np
from stray.scene import Scene
import os
import pickle
import pycocotools.mask as mask_util
import cv2
from stray import linalg
MISSING_SEGMENTATIONS = 1
INCORRECT_NUMBER_OF_SEGMENTATIONS = 2
def validate_segmentations(scene):
length = len(scene.get_image_filepaths())... | StarcoderdataPython |
1811474 | from flask import Flask, jsonify, render_template, request
from datasource.covid19 import Covid19
app = Flask(__name__)
# Returns 200 ok. Used for "Test connection" on the datasource config page.
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
# Used by the find metric options ... | StarcoderdataPython |
1615700 | class Solution:
def numDistinct(self, s: str, t: str) -> int:
m = len(s)
n = len(t)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(m + 1):
dp[i][0] = 1
for i in range(1, m + 1):
for j in range(1, n + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1... | StarcoderdataPython |
6608363 | <reponame>zefanyang/organseg_dags<filename>models/vnet/vnet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
def passthrough(x, **kwargs):
return x
def non_linearity(elu, nchan):
if elu:
return nn.ELU(inplace=True)
else:
return nn.PReLU(nchan)
class LUConv(nn.Module)... | StarcoderdataPython |
9709855 | <reponame>PyDataMadrid2016/Conference-Info
from sklearn.linear_model import LogisticRegression
logit = LogisticRegression()
logit.fit(df[['age', 'distance']], df['attended'])
def get_y(x): return -(logit.intercept_[0] + logit.coef_[0,1] * x) / logit.coef_[0,0]
plot = base_plot()
min_x, max_x = df['distance'].min(), ... | StarcoderdataPython |
4931911 | <reponame>iecedge/xos
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | StarcoderdataPython |
5068425 | <reponame>joesingo/tom_education<filename>tom_education/utils.py
def assert_valid_suffix(filename, allowed_suffixes):
"""
Check that `filename` has one of the strings in `allowed_suffixes` as a
suffix. Raises an AssertionError if not.
"""
if not any(filename.endswith(suffix) for suffix in allowed_su... | StarcoderdataPython |
9619341 | import numpy as np
from hydroDL.utils import grid
from hydroDL.post import axplot, figplot
import os
import rnnSMAP
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import imp
imp.reload(rnnSMAP)
rnnSMAP.reload()
matplotlib.rcParams.update({'font.size': 14})
matplotlib.rcParams... | StarcoderdataPython |
73090 | from pathlib import Path
import json
from django.core.management import call_command
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
import pytest
from geocontrib.models.project import Project
from geocontrib.models.user import UserLevelPermission
from geocontrib.models.u... | StarcoderdataPython |
4934854 | <filename>cyder/core/system/migrations/0001_initial.py
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'System'
db.create_table('system', (
... | StarcoderdataPython |
8100588 | import pytest
from starlette.applications import Starlette
from starlette.exceptions import HTTPException
from starlette.testclient import TestClient
import layaberr.starlette
@pytest.fixture
def client():
app = Starlette(exception_handlers=layaberr.starlette.exception_handlers)
@app.route("/bad_request")
... | StarcoderdataPython |
3217253 | <filename>parkstay/cron.py
from datetime import date, timedelta
from django_cron import CronJobBase, Schedule
from parkstay.models import Booking
from parkstay.reports import outstanding_bookings
from parkstay.emails import send_booking_confirmation
from parkstay.utils import oracle_integration
class UnpaidBookingsRe... | StarcoderdataPython |
1661644 | <filename>website/forms.py<gh_stars>1-10
from flask_wtf import Form
from wtforms import StringField, BooleanField, PasswordField, HiddenField, validators
from wtforms.validators import DataRequired
search_validator = validators.Regexp('^[a-zA-Z0-9\. ]*$', message="Search contains invalid characters.")
class SearchFor... | StarcoderdataPython |
9720439 | <reponame>mrmonkington/gaphor
from __future__ import annotations
import ast
from dataclasses import replace
from math import atan2
import gaphas
from gaphas.aspect.connector import ConnectionSink
from gaphas.aspect.connector import Connector as ConnectorAspect
from gaphas.connector import Handle
from gaphas.geometry ... | StarcoderdataPython |
6606272 | <reponame>Gianfra45/Proyecto---Programacion
def estCondicional01():
#Definir variables y otros
print("Ejemplo estructura Condicional en Python")
montoP=0
#Datos de entrada
cantidadX=int(input("Ingrese la cantidad de lapices:"))
#Proceso
if cantidadX>=1000:
montoP=cantidadX*0.80
else:
montoP=cantidadX*0.90... | StarcoderdataPython |
9786727 | # Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, ... | StarcoderdataPython |
6411973 | #!/usr/bin/env python3
import os
import sys
# Add the boundfield_renderer app to the PYTHONPATH
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
try:
from django.core.management import execute_from_... | StarcoderdataPython |
3459951 | import requests
from bs4 import BeautifulSoup
import csv
page = requests.get('https://www.census.gov/programs-surveys/popest.html')
print(page.status_code)
soup = BeautifulSoup(page.text, 'html.parser')
link_set = set()
for link in soup.find_all('a'):
web_links = link.get("href")
print(web_links)
link_set.... | StarcoderdataPython |
11365144 | """Diagnostics support for RainMachine."""
from __future__ import annotations
from typing import Any
from regenmaschine.controller import Controller
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_LATITUDE, C... | StarcoderdataPython |
9620636 | """ Functions to access node data from the Osmo database
"""
import dateutil
import pandas as pd
import pytz
import sqlalchemy
import textwrap
from getpass import getpass
from osmo_jupyter import timezone
def configure_database():
""" Configure a database object for read-only technician access to Osmo data.
... | StarcoderdataPython |
12813869 | from __future__ import unicode_literals, absolute_import
import re
from lxml import etree
import six
class Attributes(object):
def __init__(self, data, attributes):
self.data = data
self.attributes = attributes
def __pytoxml__(self, structure, element, name, pytoxml):
for key,... | StarcoderdataPython |
3438140 | <filename>archive_code/kah.py<gh_stars>0
#!/usr/bin/env python
# -*- mode: python; python-indent-tabs-mode: nil; python-indent-level: 4; tab-width: 4 -*-
###
### python wrapper for calling kpsapihelper, which is part of tbxsosd-config right now
###
### sucks...
import sys
import os
import tempfile
import subprocess... | StarcoderdataPython |
5181682 | <reponame>EncryptEx/myhackupc
from __future__ import print_function
import csv
import sys
from django.core.management.base import BaseCommand
from app import slack
from app.slack import SlackInvitationException
def slack_invite(email):
try:
slack.send_slack_invite(email)
print('Slack invite sen... | StarcoderdataPython |
3212282 | from __future__ import print_function
import os
import sys
import multiprocessing
import time
import json
import uuid
import functools
import gzip
import vcr
import vcr.cassette
import vcr.errors
import vcr.serialize
import vcr.request
from flowy import restart
from flowy import wait
from flowy import TaskError
from ... | StarcoderdataPython |
3223811 | #!/usr/bin/env python
from functools import reduce
from google.cloud.monitoring_v3 import MetricServiceClient
from google.cloud.monitoring_v3.types import LabelDescriptor, MetricDescriptor, TimeSeries
from os import environ
import psutil as ps
import requests
from signal import signal, SIGTERM
from sys import stderr
f... | StarcoderdataPython |
254191 | import os
import getpass
from fabric import Connection
from invoke import task
sudo_pass = getpass.getpass()
GIT_REPO = "https://github.com/xuhaer/Django_Blog"
con = Connection('har@192.168.127.12:22')
@task
def deploy(con):
source_folder = '~/sites/blog.xuhaer.com/Django_Blog/'
# con.run('cd {} && git pull'... | StarcoderdataPython |
56575 | import sys
import json
import time
import random
import datetime
from pytz import timezone
import requests
# Settings
url = 'https://hooks.slack.com/services/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'
exercises = {
'Plank': {'range': (20, 50), 'unit': 'second'},
'Wall Sit': {'range': (40... | StarcoderdataPython |
1977022 | <gh_stars>0
nome = str(input('Qual é o seu nome?'))
if nome == 'Daniel':
print('Que nome lindo você tem!')
print('Bom dia {} '.format(nome)) # Não precisou do "ELSE" (estrutura condicional simples)
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a segunda nota: '))
m = (n1 +... | StarcoderdataPython |
361760 | <reponame>xp4ck/api-client-python<filename>gophish/api/webhooks.py
from gophish.models import Webhook
from gophish.api import APIEndpoint
class API(APIEndpoint):
def __init__(self, api, endpoint='api/webhooks/'):
super(API, self).__init__(api, endpoint=endpoint, cls=Webhook)
def get(self, webhook_id=... | StarcoderdataPython |
8196842 | from django.contrib import admin
# Register your models here.
from .models import Journal
admin.site.register(Journal) | StarcoderdataPython |
4861839 | <gh_stars>0
from django.shortcuts import redirect, get_object_or_404
from django.views.generic import TemplateView, UpdateView
from imager_images.models import Photo, Album
from .models import ImagerProfile
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from .forms import... | StarcoderdataPython |
6455771 | <gh_stars>0
from collections import defaultdict
def text2count(body):
freq = defaultdict(int)
for word in body:
freq[word] += 1
return freq
def lexical_overlaps(title, body, idf):
features = []
words_in_body = text2count(body)
words_in_title = text2count(title)
maximum, maximum_c... | StarcoderdataPython |
5026085 | <filename>pyrival/__init__.py
import os as _os
from .version import version as __version__
for _s in ('algebra', 'combinatorics', 'data_structures', 'geometry', 'graphs', 'linear_algebra', 'numerical',
'strings', 'misc', 'tools'):
__path__.append(_os.path.join(_os.path.dirname(__file__), _s))
| StarcoderdataPython |
4985903 | # -*- coding: utf-8 -*-
from rest_framework.generics import GenericAPIView
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.exceptions import NotFound
from modules.statistics.serializers.user_stats import UserStatsSerializer
from users.models import EndW... | StarcoderdataPython |
3296509 | from typing import Any, Dict, Optional, Tuple
from starkware.cairo.lang.vm.builtin_runner import BuiltinVerifier, SimpleBuiltinRunner
from starkware.cairo.lang.vm.relocatable import RelocatableValue
from starkware.python.math_utils import safe_div
class RangeCheckBuiltinRunner(SimpleBuiltinRunner):
def __init__(... | StarcoderdataPython |
8006633 | from abc import abstractmethod
class _BaseRedBlueFastq(object):
"""Base class for fastg to redbluegraphs
Warning: This class should not be used directly.
Use derived classes instead.
"""
@abstractmethod
def fit(self):
""" Placeholder for fit this
should be implemetned by sub-... | StarcoderdataPython |
6519817 | <reponame>JHP4911/e-learning_app
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-15 21:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | StarcoderdataPython |
3439116 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from .games.games import games
from datetime import time
import random
class BoardManager(models.Manager):
def create(self, game_id):
code = hex(random.randint(0, 1048575))[2:].zfill(5).upper()
state = State.obje... | StarcoderdataPython |
4860738 | <filename>bigsi/matrix/bitmatrix.py
from bitarray import bitarray
NUM_ROWS_KEY = "number_of_rows"
NUM_COLS_KEY = "number_of_cols"
class BitMatrix(object):
"""
Manages the gets and sets of the bitmatrix to the various storage backends.
Does not know the concept of a kmer.
"""
def __init__(self,... | StarcoderdataPython |
4944215 | import pymongo
import bson
from datetime import datetime, timedelta, date
from pytz import timezone
import pytz
mdb_client = pymongo.MongoClient("mongodb://localhost:27017/")
database_name = 'juice'
def setter_juice(setter_dict={}):
database = mdb_client[database_name]
cursor_object = database['comments']
... | StarcoderdataPython |
9627259 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 20 12:17:22 2018
@author: eemeg
An example of the ICASAR software with synthetic data
"""
#%% Imports
import numpy as np
import matplotlib.pyplot as plt
import pickle # used for opening synthetic data
from pathlib impor... | StarcoderdataPython |
1687457 | <reponame>cpgoncalves/gameplayer
# <NAME> (2015), Game Theory with Python
# Game Theory and Applied A.I. Classes
# Instituto Superior de Ciências Sociais e Políticas (ISCSP)
# University of Lisbon
# <EMAIL>
#
# Three Person's Prisonners' Dilemma Game
#
# For more details see the user manual that comes with the package... | StarcoderdataPython |
124835 | """empty message
Revision ID: 09d3732eef24
Revises: <PASSWORD>
Create Date: 2020-03-12 15:13:32.832239
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '09d3732eef24'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | StarcoderdataPython |
11375522 | <reponame>theRealNonso/dappertask<filename>dappertask/api/urls.py
from django.conf.urls import url
from django.urls import include
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from rest_framework.routers import DefaultRouter
import api.views as dv
router = DefaultRout... | StarcoderdataPython |
9642764 | <filename>wsgi/static/wsgi/static/wsgi/static/wsgi/static/wsgi/static/wsgi/static/posts/templatetags/getProfile.py
from django import template
from profiles.models import Profile
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
register= template.Library()
@register.filter
def ... | StarcoderdataPython |
1788887 | """Everything related to O2 power. Hoooo baby."""
import math
import numpy as np
import pandas as pd
from . import util
def o2_power_ss(speed_series, grade_series=None):
"""Calculates steady-state oxygen consumption in the moderate domain.
For more info, see `heartandsole_local/heartandsole/powerutils.py`.
... | StarcoderdataPython |
199237 | <reponame>pygaur/gsshop<gh_stars>1-10
from django.apps import AppConfig
class GsShippingConfig(AppConfig):
name = 'gs_shipping'
| StarcoderdataPython |
9736255 | # This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests of the transcription and translation methods of Seq objects."""
import unittest
from Bio import Seq
from Bio import Alphabet
from Bio.Alph... | StarcoderdataPython |
9680675 | # coding: utf-8
import os
import io
import pytest
import tarfile
import tempfile
from mock import patch, Mock, MagicMock
import requests
from spacy_lefff import Downloader
from spacy_lefff.melt_tagger import URL_MODEL
def test_url_model():
assert requests.get(URL_MODEL).status_code == 200
def _mock_response(
... | StarcoderdataPython |
8006330 | from .builder import build_dataloader
from .collate import default_collate
| StarcoderdataPython |
5089021 | from abc import ABC, abstractmethod
import pathlib
from sklearn import base
import _pickle as cPickle
import numpy as np
import pandas as pd
import os
from enum import Enum
from typing import Tuple
from py_neuromodulation import \
(nm_projection,
nm_rereference,
nm_run_analysis,
nm_features,
nm_res... | StarcoderdataPython |
5058418 | """ Tests for barbante.maintenance.product_templates_tfidf.py.
"""
import nose.tools
import datetime as dt
import barbante.maintenance.product_templates_tfidf as pttfidf
import barbante.maintenance.tasks as maintenance
from barbante.maintenance.tests.fixtures.MaintenanceFixture import MaintenanceFixture
import barban... | StarcoderdataPython |
9772722 | <reponame>arosen93/jobflow<filename>tests/utils/test_enum.py
def test_value_enum():
from jobflow.utils import ValueEnum
class TempEnum(ValueEnum):
A = "A"
B = "B"
assert str(TempEnum.A) == "A"
assert str(TempEnum.B) == "B"
assert TempEnum.A == "A"
assert TempEnum.B == "B"
... | StarcoderdataPython |
204964 | <reponame>troswell/pynet_terry
print "hello world"
print "something else"
for i in range(7):
print i
| StarcoderdataPython |
3288813 | <gh_stars>100-1000
# Modified Bessel function I_n(z) in the complex plane
cplot(lambda z: besseli(1,z), [-8,8], [-8,8], points=50000) | StarcoderdataPython |
5132440 | from ..src.test import conftest
| StarcoderdataPython |
6673621 | from elasticsearch_dsl.query import MultiMatch
from ..documents import TaskDocument, SkillDocument, UserDocument
def _search_skills(phrase):
prod_query = MultiMatch(
fields=['name', 'title', 'description'],
query=phrase,
type='cross_fields')
return SkillDocument.search().query(prod_qu... | StarcoderdataPython |
1685969 | from errbot import BotPlugin, botcmd
from jenkinsapi.jenkins import Jenkins
from config import JENKINS_URL, JENKINS_USERNAME, JENKINS_PASSWORD
class Jenkinsbot(BotPlugin):
def connect_server(self):
server = Jenkins(JENKINS_URL, JENKINS_USERNAME, JENKINS_PASSWORD)
return server
@botcmd
de... | StarcoderdataPython |
4974651 | <filename>vectortween/ParametricAnimation.py
from functools import lru_cache
from sympy import Symbol
from sympy.parsing.sympy_parser import parse_expr
from vectortween.Animation import Animation
from vectortween.Tween import Tween
class ParametricAnimation(Animation):
"""
class to animate the value of a nu... | StarcoderdataPython |
8001905 | from distutils.core import setup
setup(
name = 'cayenneLPP',
packages = ['cayenneLPP'],
version = '0.1',
description = 'A module for the Cayenne Low Power Packet format',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/jojo-/py-cayenne-lpp', # use the URL to the github repo
downlo... | StarcoderdataPython |
1785982 |
#credits?? I even don't know ... everyone changed owner section so if you need credits pm me.
#And Thanks To The Creator Of Autopic This Script Was Made from Snippets From That Script
import requests , re , random
import urllib , os
from telethon.tl import functions
from datetime import datetime
from PIL impo... | StarcoderdataPython |
5098977 | <filename>examples/subscription_mgmt.py<gh_stars>0
"""This is the demo script to show how administrator can manage subscriptions
and schedules.
This script will not work without replacing parameters with real values.
Its basic goal is to present what can be done with this module and to
ease its usage.
"""
from mstrio... | StarcoderdataPython |
4996785 | '''Preprocessing of data for training and prediction.
'''
import re
def prepare_input(name):
'''Prepares the name of a file for classification or prediction.
'''
# Remove commas
name = name.replace(',', '')
# Lowercase filename
name = name.lower()
# Remove paths
name = name.split('... | StarcoderdataPython |
4867078 | <filename>mp-tests/test_cap_reading.py
import unittest
import os, sys
import json
# add module dirs to path
# sys.path.append("../")
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..' , 'micropython'))
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'micropytho... | StarcoderdataPython |
12864089 | <reponame>sphinx-contrib/zopeext
"""
From https://github.com/brechtm/rinohtype/blob/master/noxutil.py
https://github.com/cjolowicz/nox-poetry/discussions/289
"""
import json
from collections.abc import Iterable
from pathlib import Path
from typing import Optional
from urllib.request import urlopen, Request
from poe... | StarcoderdataPython |
5002093 | <reponame>enthought/etsproxy
# proxy module
from pyface.preference.preference_dialog import *
| StarcoderdataPython |
12847371 | from data_module.get_source_file import *
import numpy as np
class DataCleaner(object):
def __init__(self):
# 图1数据源
self.data_LD = []
self.data_I = []
self.data_LU = []
self.data_T = []
# 图2数据源
self.data_RD = []
self.data_RU = []
# 图3数据源
... | StarcoderdataPython |
12836323 | <gh_stars>0
#
# VScodeで入力をテキストから読み込んで標準入力に渡す
import sys
import os
f=open(r'.\D\D_input.txt', 'r', encoding="utf-8")
# inputをフルパスで指定
# win10でファイルを作るとs-jisで保存されるため、読み込みをutf-8へエンコードする必要あり
# VScodeでinput file開くとutf8になってるんだけど中身は結局s-jisになっているらしい
sys.stdin=f
#
# 入力スニペット
# num = int(input())
# num_list = [int(item) for item ... | StarcoderdataPython |
6435455 | # -*- coding: utf-8 -*-
# Copyright 2017, A10 Networks
# Author: <NAME>: @mike @t @<EMAIL>
import socket
from struct import *
# checksum functions needed for calculation checksum
def checksum(msg):
s = 0
# loop taking 2 characters at a time
for i in range(0, len(msg), 2):
try:
w = o... | StarcoderdataPython |
11262525 | <filename>100-Testes/threadTeste.py<gh_stars>0
from threading import Thread
import sys
import numpy as np
#documentação https://docs.python.org/release/2.5.2/lib/thread-objects.html
values = {0: [1]*100000000, 1: [3, 2]}
sequential_total = 0
threaded_total = 0
threads = []
class Th(Thread):
def __init__(self, ... | StarcoderdataPython |
169019 | <gh_stars>0
import unittest
from tests.templates.rectangle_world import (
example_wiki_ccl,
example_simple_different_regions,
)
from dekespo_ai_sdk.algorithms.connected_component_labelling import (
ConnectedComponentLabelling,
)
from dekespo_ai_sdk.core.graph import Graph
from dekespo_ai_sdk.core.shapes im... | StarcoderdataPython |
1645019 | <reponame>asimonia/pricing-alerts
import uuid
from common.database import Database
import models.stores.constants as StoreConstants
import models.stores.errors as StoreErrors
class Store:
def __init__(self, name, url_prefix, tag_name, query, _id=None):
self.name = name
self.url_prefix = url_prefix
self.tag_nam... | StarcoderdataPython |
9747182 | <filename>tensorflow/python/autograph/pyct/static_analysis/reaching_fndefs.py
# Copyright 2018 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
#
#... | StarcoderdataPython |
9738425 | # Copyright 2020 EraO Prosopagnosia Helper Dev Team, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# Supervised by Prof. <NAME> (http://www.eecg.toronto.edu/~mann/)
#
# 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 c... | StarcoderdataPython |
3359326 | <filename>Practice/divisibility.py<gh_stars>0
n = int(input())
cases = [0 for j in range(n)]
for i in range(n):
line = [int(k) for k in input().split()]
if(line[0]%line[1] == 0):
cases[i] = 0
else:
cases[i] = line[1] - line[0]%line[1]
for j in cases:
print(str(j))
| StarcoderdataPython |
11356717 | <filename>emiproc/country_code.py
# constants
country_codes = {
"ALB": 1,
"AUT": 2,
"BEL": 3,
"BGR": 4,
"DNK": 6,
"FIN": 7,
"FRA": 8,
"SMR": 8, #HJM
"FGD": 9,
"FFR": 10,
"GRC": 11,
"HUN": 12,
"IRL": 14,
"ITA": 15,
"LUX": 16,
"NLD": 17,
"NOR": 18,
"... | StarcoderdataPython |
5068574 | import numpy as np
import matplotlib.pyplot as plt
import cv2
import gin
import typing
import torch
import imutils
from scipy.stats import multivariate_normal
import xml.etree.ElementTree as ET
from soccer_robot_perception.utils.constants import CLASS_MAPPING_DETECTION
from soccer_robot_perception.utils.metrics import... | StarcoderdataPython |
6445741 | # Generated by Django 4.0.2 on 2022-02-23 11:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | StarcoderdataPython |
5153628 | """
Pet Steps
Steps file for Pet.feature
"""
import os
import json
import requests
from behave import *
from compare import expect, ensure
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
if 'VCAP_SERVICES' i... | StarcoderdataPython |
9659743 | <gh_stars>0
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __future__ import print_function
import os
import math
import argp... | StarcoderdataPython |
6533277 | import pygame
from pygame.locals import *
from pygame import mixer
import os
import time
import random
import sys
def resource_path(relative_path):
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspat... | StarcoderdataPython |
4841447 | <gh_stars>1-10
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import Sequential
import tensorflow.keras.layers as layers
from tensorflow.keras.regularizers import L2
from tensorflow.keras.applications import VGG16
from .custom_layers import L2Normalization
from models import registr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.