id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1788203 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import sys
from datetime import date
import requests
from bs4 import BeautifulSoup
sys.path.insert(1, 'models')
import db, objects
from utils import *
dbConnection = db.Database()
breaksDB = dbConnection.connect()
playersObj = objects.Players(breaksDB)
players = playersObj.read(... | StarcoderdataPython |
112669 | from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.rarithmetic import maxint
from rpython.rtyper.lltypesystem import lltype, rffi
from pypy.interpreter.error import OperationError, oefmt
from pypy.module._hpy_universal.apiset import API
@API.func("HPy HPyLong_FromLong(HPyContext *ctx, long value... | StarcoderdataPython |
1777638 | <reponame>saanyalall/Hacktoberfest2021-2
import pyautogui, time
time.sleep(5) #time you have to move your cursor to the place you want to spam
file = open('messages.txt','r')
for word in file:
pyautogui.typewrite(word)
pyautogui.press('enter')
#(for giveaways if you want to spam you name ... | StarcoderdataPython |
172115 | """add origin-protocol-policy
Revision ID: d2e8578fe341
Revises: <KEY>
Create Date: 2020-06-30 00:46:53.784035
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = "d2e8578fe341"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
... | StarcoderdataPython |
192859 |
import numpy as np
from scipy.interpolate import CubicSpline
def gen_c2_spline(x, y, init_heading, slen_start, slen_end):
'''
Generates a C2 continuous spline using scipy CubicSpline lib
x: np.array of x-coordinate points
y: np.array of y-coordinate points
'''
# define mu, a virtual pat... | StarcoderdataPython |
164431 | <gh_stars>10-100
"""Miscellaneous utilities
==========================
.. autosummary::
:toctree:
archive
restart
smake
"""
import os
import sys
from datetime import datetime
from functools import reduce
from tarfile import TarFile
from zipfile import ZipFile
from fluiddyn import util
from .. import so... | StarcoderdataPython |
1635248 | import logging
from typing import Tuple, Union
import requests
from django.conf import settings
from rest_framework import status
from moviewarehouse.movies.models import Movie
from moviewarehouse.movies.serializers import MovieSerializer
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def get_... | StarcoderdataPython |
125348 | <reponame>nagasudhirpulla/violation_msg_app
import unittest
from src.config.appConfig import loadAppConfig
from src.services.violLog import saveViolLog
class TestGetReasonId(unittest.TestCase):
def test_run(self) -> None:
"""tests the function that gets the reason Id
"""
violLogFilePath = ... | StarcoderdataPython |
4802917 | from .imutils import *
from .box_utils import *
from .imtools import *
from .. import transform | StarcoderdataPython |
132698 |
import six
from eclcli.common import command
from eclcli.common import exceptions
from eclcli.common import utils
from ..interconnectivityclient.common.utils import objectify, get_request_body
class ListCIC(command.Lister):
def get_parser(self, prog_name):
parser = super(ListCIC, self).get_parser(prog_n... | StarcoderdataPython |
34728 | <reponame>umd-coding-workshop/algorithms
#!/usr/bin/env python3
''' Use the python built-in sort for comparison
against other implementations.'''
import sys
def merge(a, b):
sorted = []
while len(a) > 0 and len(b) > 0:
if a[0] < b[0]:
sorted.append(a.pop(0))
else:
... | StarcoderdataPython |
142945 | <gh_stars>1-10
import json
from service.openweather import Openweather
from worker.worker import Worker
import datetime
class OpenweatherWorker(Worker):
"""Openweather worker"""
def __init__(self, config, widget):
self.config = config
self.cities = self._parse_cities(json.loads(config['cities'... | StarcoderdataPython |
169900 | #!/usr/bin/env python
"""
Provides a simple console that sets up basic functionality for
using herbpy and openravepy.
"""
import argparse, herbpy, numpy, openravepy
def iD():
robot.right_arm.SetActive()
jpos_list = [
[3.1670137672513565, -1.5896855774682224, -0.030490730254705722, 1.5286675450710463,... | StarcoderdataPython |
1778470 | <filename>tests/models/test_train_model.py
from ehr_functions.models import train_model
from ehr_functions.models.types._base import Model
import pandas as pd
import numpy as np
class FakeModel(Model):
def __init__(self):
super().__init__()
def train(self, x, y):
pass
def predict(self, x... | StarcoderdataPython |
3323338 | <gh_stars>10-100
# Copyright (c) 2021, <NAME>
# See LICENSE file for details: <https://github.com/moble/spherical/blob/master/LICENSE>
import os
import pytest
import numpy as np
import quaternionic
ell_max_default = 36
try:
import spinsfast
requires_spinsfast = lambda f: f
except:
requires_spinsfast = py... | StarcoderdataPython |
114354 | import csv
import numpy as np
import pandas as pd
# Removes first few rows of data that don't have actual sensor readings
def trim_csv(in_file_name, out_file_name):
with open(in_file_name, "r") as inp, open(out_file_name, "w") as out:
writer = csv.writer(out)
for row in csv.reader(inp):
... | StarcoderdataPython |
4826489 | from galaxy_test.base.populators import DatasetPopulator
from ._framework import ApiTestCase
class TestProvenance(ApiTestCase):
def setUp(self):
super(TestProvenance, self).setUp()
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
def test_show_prov(self):
history_id ... | StarcoderdataPython |
3295946 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import elasticsearch
import sys
# Connect to localhost:9200
es = elasticsearch.Elasticsearch()
es.index(
index = "ownage",
doc_type = "metadata",
id=
body = {
"name": "<NAME>",
"email": "<EMAIL>",
"md5": ... | StarcoderdataPython |
4828217 |
from rest_framework.generics import CreateAPIView
from cajas.office.models.officeItems import OfficeItems
from cajas.office.api.serializer.office_item_create_serializer import OfficeItemCreateSerializer
class CreateOfficeItem(CreateAPIView):
queryset = OfficeItems.objects.all()
serializer_class = OfficeItemC... | StarcoderdataPython |
3386976 | import numpy as np
import torch
eps = 1e-8
class metric_manager(object):
def __init__(self, task, save_dir, model, save_best_only=True):
if(
'ASC' not in task and
'SED' not in task and
'TAG' not in task
): raise ValueError('task unrecognized, got:{}'.format(ta... | StarcoderdataPython |
4818512 | import inspect
import typing
from contextlib import asynccontextmanager
import starlette.types
from di import AsyncExecutor, BaseContainer, JoinedDependant
from di.api.dependencies import DependantBase
from starlette.datastructures import State
from starlette.middleware import Middleware
from starlette.middleware.erro... | StarcoderdataPython |
1734805 | class NotFound(Exception):
pass
class InvalidParameter(Exception):
pass | StarcoderdataPython |
1683838 | from rest_framework.generics import ListAPIView, RetrieveAPIView, ListCreateAPIView
from images.models import Image
from .serializer import ImageSerializer, ImageListSerializer
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse, Http404
import json
import requests
from requests.au... | StarcoderdataPython |
298 | <gh_stars>0
load("//python:compile.bzl", "py_proto_compile", "py_grpc_compile")
load("@grpc_py_deps//:requirements.bzl", "all_requirements")
def py_proto_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
verbose = kwargs.get("verbose")
visibility = kwargs.get("visibility")
nam... | StarcoderdataPython |
167360 | import sys
from confluent_kafka.schema_registry import SchemaRegistryClient
import pyspark.sql.functions as fn
from pyspark.sql.types import StringType
#
from pyspark.sql import SparkSession
from pyspark.sql.avro.functions import from_avro, to_avro
#
# https://blogit.michelin.io/kafka-to-delta-lake-using-apache-spark-... | StarcoderdataPython |
1740658 | <filename>prashpyutil/__version__.py
__title__ = 'prashpyutil'
__description__ = 'Python Prashant utility'
__url__ = 'https://prashpyutil.readthedocs.io/'
__version__ = '1.0.4'
__build__ = 0x022200
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 <NAME>'
__cake__ = ... | StarcoderdataPython |
3277695 | import rltbt.indicators
from rltbt.filereader import parse_csv
from rltbt.trade import *
import pandas as pd
import numpy as np
TICK_SIZE=.25
indicator = rltbt.indicators.Indicators()
input_df = parse_csv('~/python_work/SkynetTheMarketCrusher/data/ESU0-test.csv')
result = get_trade_result(input_df[['time', 'open', '... | StarcoderdataPython |
1607514 | #!/usr/bin/env python3
"""Day 10:
Usage: ./solution.py 1|2 FILE
"""
from __future__ import annotations
import sys
import typing as t
from argparse import ArgumentParser
from collections import deque
from dataclasses import dataclass
verbose = False
MATCH = {
")": "(",
"]": "[",
"}": "{",
">": "<"... | StarcoderdataPython |
3211397 | <reponame>martinm82/quickbuild
import pytest
from aioresponses import aioresponses
@pytest.fixture
def aiohttp_mock():
with aioresponses() as mock:
yield mock
| StarcoderdataPython |
1619874 | <gh_stars>0
from django.contrib import admin
# Register your models here.
from .models import Profiles, Resumes
class profileAdmin(admin.ModelAdmin):
list_display=['id','name']
class resumeAdmin(admin.ModelAdmin):
list_display=['id','file','profile_id']
admin.site.register(Profiles, profileAdmin)
admin.sit... | StarcoderdataPython |
3384557 | <reponame>Asurada2015/Mofan_demo<gh_stars>1-10
"""将所有重合的地方剔除掉只留下不重合的数据"""
char_list = ['a', 'b', 'c', 'c', 'd', 'd', 'd']
sentence = 'Welcome Back to This Tutorial'
print(set(char_list)) # {'d', 'a', 'c', 'b'}
print(set(sentence))
# 大小写区分,空格区分
# {'r', 'T', 'm', 'l', 'o', 'h', 'e', 'a', ' ', 'i', 'W', 'B', 'k', 'u'... | StarcoderdataPython |
135077 | from django.shortcuts import render
from django.conf import settings
from django.utils.safestring import mark_safe
def discovery(request):
return render(request, 'shibboleth_eds/discovery.html', {
'non_js_url': getattr(settings, 'SHIBBOLETH_EDS_NON_JS_URL', 'http://federation.org/DS/DS?entityID=https%3A%2F... | StarcoderdataPython |
144542 | <reponame>savannahghi/mle
# Generated by Django 3.2.6 on 2021-08-20 11:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ops', '0017_weeklyprogramupdate_notes'),
]
operations = [
migrations.AddField(
model_name='facilitysys... | StarcoderdataPython |
3380890 | import hashlib
import unittest
import uuid
from hypergrowth.framework import Component, Qualifier
class MyComp(Component):
def __init__(self, *args, **kwargs):
self._internal = str(uuid.uuid4().hex)
def internal(self):
return self._internal
class TestFramework(unittest.TestCase):
def... | StarcoderdataPython |
3325077 | <filename>pycodecs/pybase64.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pybase64.py
#
#
# (c) 2015 <NAME>
#
# MIT License
from __future__ import print_function
from argparse import ArgumentParser
import base64
import sys, os, os.path
import logging
import hashlib
_log = logging.getLogger(__name__)
d... | StarcoderdataPython |
3311590 | import os
from collections import Counter
import numpy as np
import tensorflow as tf
flags = tf.compat.v1.app.flags
flags.DEFINE_string('train_file', 'oliver.txt', 'text file to train LSTM')
flags.DEFINE_integer('seq_size', 32, 'sequence length')
flags.DEFINE_integer('batch_size', 16, 'batch size')
flags.DEFINE_inte... | StarcoderdataPython |
75542 | <gh_stars>1-10
import os
from typing import Callable, Optional
from urllib.parse import urlparse
from kentik_api import KentikAPI
from kentik_api.utils import get_credentials
from kentik_api.utils.auth import load_credential_profile
from kentik_synth_client import KentikSynthClient
from synth_tools import log
def _... | StarcoderdataPython |
43929 | <reponame>dcshoecousa/MimiWork
import uvicorn
from fastapi import FastAPI, Request, status
from fastapi.encoders import jsonable_encoder
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.exceptions import RequestValidationError
from fastapi.responses impo... | StarcoderdataPython |
62727 | <reponame>pugaru/lmsimpacta<filename>core/admin.py
from django.contrib import admin
from django import forms
from core.models import Curso,Aluno,Professor,Disciplina
from django.contrib.auth.admin import UserAdmin
from django.contrib import admin
from .models import Post
admin.site.register(Post)
class Nov... | StarcoderdataPython |
1646524 | <reponame>artorious/python3_dojo
#!/usr/bin/env python3
""" Keep track of time
Defines the structure and capabilities of a Stopwatch
"""
from time import time
from multiple_inheritance_sample import Top
class Timer(Top):
"""
Provides stopwatch objects that a programmer can use to time the
execution ... | StarcoderdataPython |
3315558 | f=open('data.txt','wb')
f.write('some data')
f.close()
#写入数字
| StarcoderdataPython |
3290388 | <gh_stars>0
# encoding: utf-8
from django.apps import apps
def attach_likescount_to_queryset(queryset, as_field="likes_count"):
"""Attach likes count to each object of the queryset.
Because of laziness of like objects creation, this makes much simpler and more efficient to
access to liked-object number ... | StarcoderdataPython |
93017 | from pathlib import Path
import plistlib
import yaml
from jinja2 import Template
IN_PATH = Path(__file__).parent.joinpath("../template/myst.tmLanguage.j2.yaml")
LANGUAGE_PATH = Path(__file__).parent.joinpath("../template/languages.yaml")
DIRECTIVE_PATH = Path(__file__).parent.joinpath("../template/directives.yaml")
O... | StarcoderdataPython |
150111 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import re
from kylinpy.exceptions import KylinUnsupportedType
from kylinpy.logger import logger
from kylinpy.utils.... | StarcoderdataPython |
3314272 | # Copyright 2020 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
3242434 | import random
from model.contact import Contact
def test_modify_contact_by_id(app, db, check_ui):
app.open_home_page()
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_name="Nana", middlename="Ver", lastname="Ko"))
old_contacts = db.get_contact_list()
contact = random.choi... | StarcoderdataPython |
3335723 | from typing import Any, Callable, Dict, List, Tuple
import numpy as np
__all__ = ["mcts", "MCTSNode"]
# TODO: sort this out:
State, Action = Any, Any
Player, Game = Any, Any
def mcts(starting_node: "MCTSNode",
game: Game,
estimator: Callable,
mcts_iters: int,
c_puct: float,
... | StarcoderdataPython |
3313764 | import pathlib
from graphysio.dialogs import askOpenFilePath
from .csv import CsvReader
from .edf import EdfReader
from .parquet import ParquetReader
file_readers = {'csv': CsvReader, 'parquet': ParquetReader, 'edf': EdfReader}
file_readers = {k: mod for k, mod in file_readers.items() if mod.is_available}
class Fi... | StarcoderdataPython |
1609945 | <gh_stars>0
DEBUG = False
file = "input.txt"
if DEBUG:
file = "test_input.txt"
class Bag(object):
def __init__(self, name):
self.name = name
self.contains = set()
def search_contain_bag(bags, bag_name) -> int:
search_bag = bags[bag_name]
if len(search_bag.contains) == 0:
re... | StarcoderdataPython |
1711942 | import torch
def swinTransformerObjectDetectionToCustomerModel(num_class=2,model_path='mask_rcnn_swin_tiny_patch4_window7.pth',model_save_dir=""):
pretrained_weights = torch.load(model_path)
pretrained_weights['state_dict']['roi_head.bbox_head.fc_cls.weight'].resize_(num_class + 1, 1024)
pretrained_weight... | StarcoderdataPython |
3252560 | # i = 0
# while i < len(df)-1:
# if (df.start_date[i] == df.end_date[i]) and (
# df.start_date[i] == df.end_date[i+1]) and(
# df.start_date[i] == df.start_date[i+1]) and (
# (df.end_time[i] - df.start_time[i+1]) <= 1.0e-5):
# df.loc[i, 'end_time'] = df.end_time[i+1]
# ... | StarcoderdataPython |
1723775 | <filename>Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Support/DVB/DateTime.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - p... | StarcoderdataPython |
98703 | <reponame>mfpx/ogresquatch-bot<gh_stars>0
""""
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
Description:
This is a template to create your own discord bot in python.
Version: 2.8
"""
import json
import os
import platform
import random
import sys
import asyncio
import sqlite3
from pytz import timezone
impo... | StarcoderdataPython |
3352859 | <reponame>Jerrywx/Python_Down
from django.contrib import admin
# Register your models here.
from django.contrib import admin
from TestModel.models import Test
# Register your models here.
admin.site.register(Test) | StarcoderdataPython |
28670 | from django.contrib.auth import authenticate
from django.shortcuts import render
from rest_framework import serializers
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from .models import Editor
fr... | StarcoderdataPython |
3317121 | <filename>plots/sigmoid.py
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(12)
y = x
plt.plot(x, y, 'o')
def plot():
plt.show()
| StarcoderdataPython |
1693536 | <filename>BlackVision/Applications/ProjectManagerPrototype/SequenceAssetAccessor.py<gh_stars>1-10
from AssetAccessor import AssetAccessor
class SequenceAssetAccessor(AssetAccessor):
def __init__(self, projectManager):
AssetAccessor.__init__(self, projectManager)
| StarcoderdataPython |
4838117 | <gh_stars>100-1000
from unittest import TestCase
from SqrtX import SqrtX
class TestSqrtX(TestCase):
def test_mySqrt(self):
sx = SqrtX()
self.assertTrue(sx.mySqrt(0) == 0)
self.assertTrue(sx.mySqrt(1) == 1)
self.assertTrue(sx.mySqrt(2147395599) == 46339)
self.assertTrue... | StarcoderdataPython |
78348 | from django import forms
from selectable.forms import AutoCompleteSelectMultipleField
from website.apps.taxonomy.lookups import TaxonomyLookup
from .models import Package
class PackageCreateEditForm(forms.ModelForm):
# Use a radio select field rather than the default.
pkg_type = forms.ChoiceField(label='Pa... | StarcoderdataPython |
3288223 | <gh_stars>1-10
import numpy as np
from smac.facade.smac_ac_facade import SMAC4AC
from smac.epm.gaussian_process_mcmc import GaussianProcessMCMC, GaussianProcess
from smac.epm.gp_base_prior import HorseshoePrior, LognormalPrior
from smac.epm.util_funcs import get_types, get_rng
from smac.initial_design.sobol_design imp... | StarcoderdataPython |
3350135 | <gh_stars>0
import unittest
import numpy as np
import hmc
class TestGeneralizedLeapfrog(unittest.TestCase):
def test_generalized_leapfrog(self):
distr = hmc.applications.banana
t = 0.5
sigma_theta = 2.
sigma_y = 2.
theta, y = distr.generate_data(t, sigma_y, sigma_theta, 1... | StarcoderdataPython |
1747930 | <gh_stars>0
from io import BytesIO
from unittest import TestCase
from helper import encode_varint, int_to_little_endian, read_varint
class Script:
def __init__(self, items):
self.items = items
def __repr__(self):
result = ''
for item in self.items:
if type(item) == int:
... | StarcoderdataPython |
1703895 | import argparse
from data.nasdaqdatahandler import NasdaqDataHandler
from utils.logger import logger
def main(tag, source):
if source == "nasdaq":
handler = NasdaqDataHandler(tag)
# data = handler.obtain()
data = handler.get()
logger.info("Data has %d columns", len(data))
else:... | StarcoderdataPython |
67139 | <gh_stars>100-1000
from .hypnograms import SparseHypnogram, DenseHypnogram
| StarcoderdataPython |
3286257 | #!/usr/bin/env python
# Copyright 2018-2020 Descartes Labs.
#
# 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 applicabl... | StarcoderdataPython |
3397099 | from geoalchemy2.types import Geography
from sqlalchemy import Boolean, Column, ForeignKey, Integer, Numeric, String
from sqlalchemy.orm import relation
from app.db.base_class import Base
class Shop(Base):
__tablename__ = 'shops'
id = Column(Integer, primary_key=True, index=True)
name = Column(String(le... | StarcoderdataPython |
3385317 | """
**A microservice that provides the function of rendering Markdown as an image.**
- API Documents:
- [Redoc](/docs) (Easier to read and more beautiful)
- [Swagger UI](/docs/test) (Integrated interactive testing function)
GitHub Project: https://github.com/mixmoe/MarkdownRender
"""
from fastapi import Body... | StarcoderdataPython |
115268 | from .covalent_api import * | StarcoderdataPython |
3290421 | <filename>nodes/odroid_show.py
#!/usr/bin/env python
'''
Copyright 2012 the original author or authors.
See the NOTICE file distributed with this work for additional
information regarding copyright ownership.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in complianc... | StarcoderdataPython |
152385 | <reponame>Jumpscale/jumpscale_examples7
from JumpScale import j
import JumpScale.grid.zdaemon
j.application.start("zdaemon")
j.logger.consoleloglevel = 6
zd = j.core.zdaemon.getZDaemon(port=3333, nrCmdGreenlets=50)
class MyCommands():
def __init__(self, daemon):
self.daemon = daemon
def authen... | StarcoderdataPython |
3394230 | <filename>test/test_sample.py
from test.testbase import DbIsolatedTest, run_test_as_sync
from db.python.layers.sample import SampleLayer, SampleType
class TestSample(DbIsolatedTest):
"""Test sample class"""
# tests run in 'sorted by ascii' order
@run_test_as_sync
async def test_add_sample(self):
... | StarcoderdataPython |
1685705 | # coding: utf-8
from aiohttp import web
from aiohttp.web_app import Application
from aiohttp.web_fileresponse import FileResponse
from aiohttp.web_request import Request
import os
from sqlalchemy.orm.exc import NoResultFound
from rolling.kernel import Kernel
from rolling.server.controller.base import BaseController
fr... | StarcoderdataPython |
1759880 | load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("//rules/scala_proto/3rdparty:maven.bzl", "list_dependencies")
def scala_proto_register_toolchains():
native.register_toolchains("@rules_scala_annex//rules/scala_proto:scalapb_scala_proto_toolchain")
def scala_proto_repositories():
... | StarcoderdataPython |
122167 | <gh_stars>0
# Generated by Django 2.2.7 on 2020-04-06 04:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travels', '0047_auto_20200406_1335'),
]
operations = [
migrations.AlterField(
model_name='tourplan',
nam... | StarcoderdataPython |
4819365 | <reponame>vidma/django-webtopay
from django.conf import settings
class WebToPaySettingsError(Exception):
"Raised when WebToPay settings are incorrect"
# Mandatory part
try:
WTP_PASSWORD = settings.WEBTOPAY_PASSWORD
except:
raise WebToPaySettingsError("Please provide WEBTOPAY_PASSWORD in settings")
CHECK... | StarcoderdataPython |
1704257 | from pathlib import Path
from typing import Any, List, Optional
from datamodel_code_generator.imports import IMPORT_ENUM
from datamodel_code_generator.model import DataModel, DataModelFieldBase
from datamodel_code_generator.reference import Reference
from datamodel_code_generator.types import DataType, Types
class E... | StarcoderdataPython |
3228436 | from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import time
import atexit
mh = Adafruit_MotorHAT(addr=0x60)
def turnOffMotors():
mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(4).run(Adafrui... | StarcoderdataPython |
53785 | <reponame>reasner/temps
import os
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
#SETUP
cd = os.path.join(os.path.expanduser("~"),r'Documents',r'projects',r'temps')
cd_dotdot = os.path.join(os.path.expanduser("~"),r'Documents',r'projects')
if not os.path.exists(os.path.join(cd,r'simple_map... | StarcoderdataPython |
1630089 | <filename>correlation.py
#!/usr/bin/env python
import numpy as np
import sys
import glob
import tarfile
import os
import subprocess
import csv
subids=[ 'NYU_0050954', 'NYU_0050955', 'NYU_0050956', 'NYU_0050957', 'NYU_0050958', 'NYU_0050959', 'NYU_0050960',
'NYU_0050961', 'NYU_0050962', 'NYU_0050964', 'NYU_00... | StarcoderdataPython |
3340486 | from typing import List
class Solution:
def rotatedDigits(self, N: int) -> int:
res = 0
for i in range(1, N+1):
S = str(i)
if '3' in S or '7' in S or '4' in S:
continue
if '2' in S or '5' in S or '6' in S or '9' in S:
res += 1
... | StarcoderdataPython |
1762564 | <reponame>brianchebon/python
# WRITE YOUR CODE SOLUTION HERE
from datetime import date
date = date.today()
day = date.strftime("%a")
bus_fare = {
"Mon":100,
"Tue":100,
"Wen":100,
"Thur":100,
"Fri":100,
"Sat":60,
"Sun":80
}
fare = None
if day in bus_fare:
print(date)
print(day)
... | StarcoderdataPython |
3225973 | <reponame>michaelbynum/galini<gh_stars>0
# Copyright 2019 <NAME>
#
# 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 appl... | StarcoderdataPython |
129042 | # coding: utf-8
# uow/model.py
import datetime
from sqlalchemy import Column, Date, ForeignKey, Integer, MetaData, String, Table
from sqlalchemy.orm import mapper, relationship
from model import Line, Order
metadata = MetaData()
# child
line = Table(
"line",
metadata,
Column("id", Integer, primary_key... | StarcoderdataPython |
1609247 | <gh_stars>10-100
from copy import deepcopy
from . import *
class Object3D(Three):
def __init__(self, name=None, position=(0,0,0), rotation=(0,0,0), scale=(1,1,1),
visible=None, castShadow=None, receiveShadow=None,
userData=None, layers=None, cannonData=None, **kwargs):
Thr... | StarcoderdataPython |
1666171 | <filename>concorde/cli/cli.py
# concorde.cli.cli
import argparse
from ..crypto import secp384r1
from ..acme import Client, Error
from .commands import \
key_create, \
acct_create, acct_status, acct_update, \
order_create, order_status, order_authz, order_finalize, order_get_cert, \
... | StarcoderdataPython |
1617864 | from fastai.vision import *
import cv2
classes = ['Food', 'Attire', 'Decorationandsignage', 'misc']
f = open('original_dataset/train.csv', 'r')
arr = f.read()
data = list(map(str, arr.split('\n')))
data = data[1:-1]
print('Number of training samples : ', len(data))
filename = []
class_val = []
for i in range(len(data... | StarcoderdataPython |
3284388 | <gh_stars>0
"""
VERY simple chat program.
Open two command prompts and start this file. Enter a different name for each one.
Have one send a message to the other.
Check out inbox/sent folders for both users
Read the message.
"""
# Import all we need
import os
from users.chat_users import ChatUser... | StarcoderdataPython |
1738036 | <gh_stars>0
#coding:utf-8
#
# id: bugs.core_6254
# title: AV in engine when using SET TRANSACTION and ON TRANSACTION START trigger uses EXECUTE STATEMENT against current transaction
# decription:
# Confirmed crash on: WI-V3.0.6.33251; WI-T4.0.0.1779
# Checked on: ... | StarcoderdataPython |
1617331 | <reponame>kitarp29/ds-algo-solutions
#!/bin/python
import math
import os
import random
import re
import sys
# Complete the pangrams function below.
def pangrams(string):
ascii_array = []
#convert the string to lower case
lower_string = string.lower()
for i in range(len(lower_string)):
ascii_ar... | StarcoderdataPython |
67549 | <gh_stars>1-10
from charles.charles import *
| StarcoderdataPython |
3266399 | <filename>granola/tests/test_attribute_access.py
import pytest
from granola.tests.conftest import query_device
def test_bk_cereal_should_not_have_methods_that_arent_in_pyserial(mock_cereal):
# Given a mock pyserial class has been initialized
with pytest.raises(AttributeError):
# When we access a met... | StarcoderdataPython |
3306983 | <reponame>bmeg/bmeg-etl<filename>transform/dvc/dvc2cytoscape.py<gh_stars>1-10
import yaml
import glob
import json
from bmeg.util.logging import default_logging
from bmeg.util.cli import default_argument_parser
""" simple transform of dvc into cytoscape """
DEFAULT_DIRECTORY = 'meta'
def transform(
dvc_path="./*... | StarcoderdataPython |
4813044 | <reponame>NathaliaBarreiros/nlp_api
from .crud_user import user
from .crud_role import role
from .crud_zeroshot_inference import zeroshot_inference
from .crud_text_inference import text_inference
| StarcoderdataPython |
3297250 | #!/usr/bin/env python
from git import Repo,remote
import git
import os
import shutil
from github import Github
import os
from jinja2 import Environment, FileSystemLoader
#https://gist.github.com/wrunk/1317933/d204be62e6001ea21e99ca0a90594200ade2511e
import errno
def copydir(src, dest):
try:
shutil.copytree... | StarcoderdataPython |
1686253 | #!/usr/bin/python
import sys
import os
import subprocess as sp
from os.path import expanduser
user = sys.argv[1]
home_path = expanduser("~%s" % user)
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
f_content = "[Desktop Entry]\nName=CommanderPi\nComment=System info and overclocking... | StarcoderdataPython |
3287861 | from django.db import models
from django.utils.translation import ugettext_lazy as _
from awx.api.versioning import reverse
from awx.main.models.base import CommonModel
__all__ = ['ExecutionEnvironment']
class ExecutionEnvironment(CommonModel):
class Meta:
ordering = ('-created',)
PULL_CHOICES = [... | StarcoderdataPython |
3220763 | import os
import logging
import json
from collections import defaultdict
import hmac
from flask import (abort, Flask, session, render_template,
session, redirect, url_for, request,
flash, jsonify)
from flask_session import Session
from sqlalchemy import desc
from mlapp import GitHu... | StarcoderdataPython |
3301584 | <reponame>veltri/DLV2
input = """
%#maxint=27.
numero_depositi(3).
ristorante(5).
ristorante(6).
ristorante(12).
ristorante(19).
ristorante(20).
ristorante(27).
deposito(R) | -deposito(R) :- ristorante(R).
:- numero_depositi(N), not #count{D: deposito(D)}=N.
serve(R,Dist) :- ristorante(R), distanza(... | StarcoderdataPython |
1769552 | from enum import IntEnum
from typing import Callable, Dict, List, Iterable
from spherov2.commands.animatronic import R2LegActions, Animatronic
from spherov2.commands.api_and_shell import ApiAndShell
from spherov2.commands.core import IntervalOptions, Core
from spherov2.commands.io import AudioPlaybackModes, IO
from sp... | StarcoderdataPython |
38978 | <reponame>MacHu-GWU/crawlib-project
# -*- coding: utf-8 -*-
import pytest
from pytest import raises
from crawlib.entity.base import Entity, RelationshipConfig, Relationship
def test_validate_implementation():
# validate abstract method
class Country(Entity):
pass
with raises(NotImplementedError... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.