id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3213870 | <reponame>deveshbajpai19/CodeForces
__author__ = '<NAME>'
'''
https://codeforces.com/problemset/problem/996/A
Solution: This the popular coin change problem. We can use the standard quadratic DP solution, but since the coins
are less, we just iterate over them and compute the bills. Since we are minimizing the bills ... | StarcoderdataPython |
76208 | from django.db import models
from django.utils.text import slugify
from django.utils.timezone import now
from django.urls import reverse
class Nfq(models.Model):
name = models.CharField(max_length=100)
level = models.IntegerField(null=True)
def __str__(self):
return self.name
class Program_Cata... | StarcoderdataPython |
101792 | #!/usr/bin/env python3
import logging
import os
import sys
from cryptojwt import KeyJar
# from cryptojwt.jwk import pems_to_x5c
from flask import Flask
from oidcop.utils import create_context
from oidcop.utils import lower_or_upper
from oidcrp.configure import Configuration
from oidcrp.configure import create_from_con... | StarcoderdataPython |
4821974 | <filename>src/vehicle/stereo_camera.py
from .vehicle_peripheral import VehiclePeripheral
import threading
import cv2
import logging
import base64
class USBCameraCaptureThread(threading.Thread):
def __init__(self, cam_no: int, dev_no: int):
super(USBCameraCaptureThread, self).__init__()
self._cam_... | StarcoderdataPython |
3201524 | <reponame>shuds13/python-proj-template
#import click
#<EMAIL>()
def cli():
print("Hello, World!")
if __name__ == '__main__':
cli()
| StarcoderdataPython |
1657171 | <filename>tests/test_prepare_file.py<gh_stars>1-10
from pathlib import Path
from syntactic_analysis import generate_analysis
from syntactic_analysis.analysis import check_tree
def test_parsed_sentences():
in_file = 'input/test_processed.tsv'
content = Path(in_file).read_text()
tree, version_trees, output... | StarcoderdataPython |
3352457 | from tradeiobot.util import balance_changes
def test_balance_changes_none():
current = dict(BTC=1.23, ETH=2.34)
previous = dict(BTC=1.23, ETH=2.34)
assert dict() == balance_changes(current, previous)
def test_balance_change_new_asset():
current = dict(BTC=1.23, ETH=2.34)
previous = dict(BTC=1.23)
... | StarcoderdataPython |
3249140 | import os
def get_list(dirname):
files = os.listdir(dirname)
files = filter(lambda x: x.endswith('.wav'), files)
files = ['%s/%s'%(dirname,name) for name in files]
train = filter(lambda x: x.endswith('1-16K.wav'), files)
test = filter(lambda x: x.endswith('2-16K.wav'), files)
retu... | StarcoderdataPython |
3220175 | from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from TODO import views
router = routers.DefaultRouter()
router.register(r'todos', views.TodoView, 'todo')
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', ... | StarcoderdataPython |
140083 | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from db_config import Base, Starships, User
engine = create_engine('sqlite:///fleet.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.bind = engine
... | StarcoderdataPython |
3336207 | from flask import Flask, redirect, url_for, render_template, request
from api import errorFields, getSpecificIP, getOwnIP, rateLimitedFields
from typing import Any, Dict, Union # For type-annotations.
app = Flask(__name__)
# ! This function handles both home() and searchIP() into one function.
def ip_query(given_ip: ... | StarcoderdataPython |
3241578 | <reponame>aejsi5/digifaa
# Generated by Django 3.0.1 on 2020-08-17 21:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dfa_App', '0026_auto_20200817_2241'),
]
operations = [
migrations.AlterField(
model_name='constraint',
... | StarcoderdataPython |
3241027 | <reponame>hadfieldnz/seapy
#!/usr/bin/env python
"""
ezgrid.py
Functions for generating ROMS grid files
Copyright (c)2020 University of Hawaii under the MIT-License.
"""
import numpy as np
from datetime import datetime
import netCDF4
import seapy
from collections import namedtuple
def create_grid(grid_file, l... | StarcoderdataPython |
1770225 | <gh_stars>0
# Analysis code for {{ cookiecutter.repo_name }}
| StarcoderdataPython |
116798 | from exec5 import max2
def max3(x, y, z):
return max2(max2(x, y), z)
print(max3(2, 4, 6))
print(max3(3, 1, 0)) | StarcoderdataPython |
179913 | <filename>ShellyMQTT.indigoPlugin/Contents/Server Plugin/tests/mocking/IndigoDevice.py
class IndigoDevice:
def __init__(self, id, name):
self.id = id
self.name = name
self.states = {}
self.states_meta = {}
self.pluginProps = {}
self.image = None
self.brightne... | StarcoderdataPython |
3259349 | from particle import Particle
# A subclass of Particle
class CrazyParticle(Particle):
# Just adding one variable to a CrazyParticle.
# It inherits all other fields from "Particle", and we don't have to
# retype them!
# The CrazyParticle constructor can call the parent class (super class)
# c... | StarcoderdataPython |
3349141 | import numpy
import mpl_toolkits.mplot3d
import matplotlib.pyplot as plt
import numpy_to_stl
def get_example_array():
return numpy.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
#
# def get_example_array():
# return numpy.ones((100, 100))
if __name__ == "__main__":
array = get_example_array()
mesh = num... | StarcoderdataPython |
187843 | # Core imports
import os
# Third party imports
from airtable import Airtable
SMT_BASE_ID = "appvMqcwCQosrsHhM"
PROJECTS_TABLE = "Labs - Projects"
PROJECTS_WHERE_COHORT_AND_ACTIVE = """AND(UPPER({{Cohort}}) = UPPER("{}"), {{Active?}} = True())"""
def get_all_active_projects(cohort: str) -> list:
"""
Retrie... | StarcoderdataPython |
150442 | #!/usr/bin/env python
import sys
# https://github.com/Callidon/pyHDT
import hdt
import numpy as np
from tqdm import tqdm
def generate_stats(doc):
n_edges = len(doc)
n_vertices = 0
# create integer mapping
vertices = set()
triples, c = doc.search_triples('', '', '')
for s, p, o in tqdm(triple... | StarcoderdataPython |
170006 | <reponame>Green-Resilience/wfRunner<gh_stars>0
#-------------------------------------------------------------------------------
# Name: Weather.py
# Purpose: Green Scale Tool Weather Module (sets up weather dictionary from epw file)
#
# Author: <NAME>
#
# Created: 15/09/2013
# Copyright: (c... | StarcoderdataPython |
1675847 | <filename>moneta/repositories/pypi.py
import os.path
import tarfile
import zipfile
from distutils.version import LooseVersion
from django.conf import settings
from django.conf.urls import url
from django.core.exceptions import PermissionDenied
from django.core.files.uploadedfile import UploadedFile
from django.urls im... | StarcoderdataPython |
3381482 | <gh_stars>0
# -*- coding: utf-8 -*-
from snewpy.flavor_transformation \
import MassHierarchy, MixingParameters, \
NoTransformation, AdiabaticMSW, NonAdiabaticMSW, \
TwoFlavorDecoherence, ThreeFlavorDecoherence, NeutrinoDecay
from astropy import units as u
from astropy import constants as c
import numpy a... | StarcoderdataPython |
5537 | <gh_stars>1-10
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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... | StarcoderdataPython |
1775975 | from dataclasses import dataclass
@dataclass
class LoggingOptions:
every_iter: bool = True
trades: bool = True
orders: bool = True
total_profit: bool = True
start: bool = True
stop: bool = True
| StarcoderdataPython |
3317658 | <reponame>magomar/poetry-multistage-docker<gh_stars>0
from importlib.metadata import version
__version__ = version('my-package') | StarcoderdataPython |
1617573 | # -*- coding: utf-8 -*-
"""
Author: <NAME> <<EMAIL>>
License: MIT
"""
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
# Parameters
fkind = "float32"
# Initialize figure
fig = plt.figure(figsize = (10, 5), facecolor = "white")
fig.patch.set_alpha(0.)
ax1 = f... | StarcoderdataPython |
1759383 |
from datetime import datetime
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
class ApiRequestException(Exception):
def __init__(self, response):
msg = "(%s) %s [%s]" % (response.status_code, response.reason, response.url)
super(ApiRequestException, self).__init__(msg)
self.response = response... | StarcoderdataPython |
1646027 | <reponame>lengyuner/fly_video_analysis
# *_* : coding: utf-8 *_*
'''
datasets process for object detection project.
for convert customer dataset format to coco data format,
'''
import traceback
import argparse
import datetime
import json
import cv2
import os
import csv
import numpy as np
__CLASS__ = ['__background_... | StarcoderdataPython |
102609 | #!/usr/bin/env python3
def main():
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
a = [ab[i][0] for i in range(n)]
b = [ab[i][1] for i in range(n)]
#A, Bの最小値
minA, minB = min(a), min(b)
#同一人物か判定
workerA = a.index(min(a))
workerB = b.index(min(b))
if... | StarcoderdataPython |
3288100 | """
Input / output helpers
"""
import logging
from pathlib import Path
# third-party libs
import numpy as np
# local libs
from recipes.logging import logging, get_module_logger
from .utils import int2tup
# module level logger
logger = get_module_logger()
logging.basicConfig()
logger.setLevel(logging.INFO)
def lo... | StarcoderdataPython |
1772447 | # -*- coding: utf-8 -*-
# Base class for grating stimulus.
#
# Copyright (C) 2010-2011 <NAME>
#
# See LICENSE.TXT that came with this file.
from __future__ import division
import numpy as np
np.seterr(all='raise')
import random
import logging
from VisionEgg.Gratings import SinGrating2D
from VisionEgg.Textures import ... | StarcoderdataPython |
1721252 | try:
from PyQt5.QtWidgets import QComboBox
from PyQt5.QtCore import Qt
except ImportError:
from PySide2.QtWidgets import QComboBox
from PySide2.QtCore import Qt
class ComboBox(QComboBox):
def findData(self, any_obj, role=Qt.UserRole, *args, **kwargs):
if args or kwargs:
return ... | StarcoderdataPython |
3230901 | <reponame>josejachuf/rest
import io
import re
from setuptools import setup
with io.open("emmett_rest/__version__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
setup(
name="Emmett-REST",
version=version
)
| StarcoderdataPython |
1797451 | import decimal
import pytest
import json
import requests
from datetime import datetime
from mock import Mock
import pyticketswitch
from pyticketswitch.client import Client, POST, GET
from pyticketswitch import exceptions
from pyticketswitch.trolley import Trolley
from pyticketswitch.reservation import Reservation
from ... | StarcoderdataPython |
1761510 | t=int(input())
while(t>0):
t=t-1
n=int(input())
l=list(map(int,input().split()))
l1=[ l[i] for i in range(0,len(l)) if(l[i]<0) ]
l2=[ l[i] for i in range(0,len(l)) if(l[i]>0) ]
if(len(l2)==0 or len(l1)==0):
print(len(l),len(l))
else:
print(max(len(l1),len(l2)),min(l... | StarcoderdataPython |
18942 | <reponame>mathiascode/pyinstaller
#!/usr/bin/env python3
# --- Copyright Disclaimer ---
#
# In order to support PyInstaller with numpy<1.20.0 this file will be duplicated for a short period inside
# PyInstaller's repository [1]. However this file is the intellectual property of the NumPy team and is
# under the terms ... | StarcoderdataPython |
3204948 | from twilio.twiml.messaging_response import MessagingResponse
from flask import Flask, request
import covid_states
import covid_usa
app = Flask(__name__)
# List for checking State abbreviations
all_states = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY',
... | StarcoderdataPython |
1674762 | from typing import Callable
import pytest
import yaml
from app.connectors.argo.models.ArgoWorkflow import ArgoWorkflow
from app.connectors.container_tag_params import ContainerTagParams
from app.domain.models import KickerMessage, WorkflowType
from app.utils import get_project_root
@pytest.fixture
def verify_overfo... | StarcoderdataPython |
3303313 | <reponame>hostcontrol/django-configurable-tables<gh_stars>0
from django.db import models
class Customer(models.Model):
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
email_address = models.EmailField()
has_paid = models.BooleanField()
registered_at = mo... | StarcoderdataPython |
3292412 | from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import logging
import argparse
import csv
import os
from doppelganger import (
inputs,
Accuracy,
CleanedData,
Configuration,
HouseholdAllocator,
SegmentedData,
BayesianNetworkModel,
Population,
... | StarcoderdataPython |
1704830 | <reponame>arlo-lib/ARLO
"""
This module contains the implementation of the Class Logger. This is used in all the library to perform logging.
The Class Logger is the only one in the library that does not inherit from the Class AbstractUnit.
"""
import os
import datetime
class Logger:
"""
This class is used f... | StarcoderdataPython |
3383135 | # -*- coding: utf-8 -*-
"""
Original corpus is in JSON format. But OpenNMT separates data to two files by source/target (src/tgt).
Also OpenNMT preprocess is not flexible dealing with one-to-one/one-to-many data format.
Therefore this script means to do two things:
1. Separate a JSON data file to source/target files.
2... | StarcoderdataPython |
3331092 | <reponame>brenobeirigo/mod
import numpy as np
def movingaverage(data, w, start=0, start_den=2):
new_data = np.zeros(len(data))
for i in range(len(data)):
if i < start:
new_data[i] = sum(data[i: i + int(w / start_den)]) / int(
w / start_den
)
continue... | StarcoderdataPython |
3245577 | <gh_stars>0
"""Module containing the API for encoding sensitive data via kubeseal-cli."""
import logging
import sys
from os import environ
from os.path import exists
import json_log_formatter
from flask import Flask
from flask_cors import CORS
from flask_restful import Api
from .config import AppConfigEndpoint
from .... | StarcoderdataPython |
199709 | <reponame>jackylinwh/dinosaur
from django.contrib import admin
# Register your models here.
from django import forms
from django.utils.html import format_html
from mptt.admin import MPTTModelAdmin, DraggableMPTTAdmin
from blog.models import Article, BlogSettings, BlogConfig, Tag
class ArticleAdmin(DraggableMPTTAdmi... | StarcoderdataPython |
3301213 | from calendartools.validators.base import *
| StarcoderdataPython |
1634329 | import pickle
import os
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
import multiprocessing
# from sklearn.utils.random import sample_without_replacement
# from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor
# from sklearn.ensemble import GradientBoostingClassifi... | StarcoderdataPython |
62317 | <filename>stko/optimizers/gulp.py
"""
GULP Metal Optimizer
==============
#. :class:`.GulpOptimizer`
#. :class:`.GulpMDOpimizer`
Wrappers for calculators within the :mod:`gulp` code.
Examples
--------
While metal atoms are not required, UFF4MOF is useful because it
encompasses almost all chemical environments commo... | StarcoderdataPython |
119666 | <reponame>awesome-archive/DjangoBlog
#!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: liangliangyy
@license: MIT Licence
@contact: <EMAIL>
@site: https://www.lylinux.org/
@software: PyCharm
@file: forms.py
@time: 2016/11/12 下午2:45
"""
from .models import Comment
from django import forms
from django.f... | StarcoderdataPython |
1691212 | <filename>A Game Of Robots/a_game_of_robots.py<gh_stars>0
t = int(input())
for _ in range(t):
string = [s for s in input()]
flag = True
idx = 0
while(idx<len(string)):
if( string[idx] != '.'):
digits = int(string[idx])
for i in range(1,digits+1):
... | StarcoderdataPython |
113540 | '''
Max Of Three
Exercise 28
Implement a function that takes as input three variables, and returns the largest of the three.
Do this without using the Python max() function
'''
import random
def max_of_three(a, b, c):
if a>b:
if a>c:
return a
else:
return c
else:
... | StarcoderdataPython |
4837945 | <reponame>M-J-Murray/tanuki
from __future__ import annotations
from datetime import datetime
from helpers.example_metadata import ExampleMetadata
from tanuki.data_store.column import Column
from tanuki.data_store.data_store import DataStore
from tanuki.data_store.index.index import Index
from tanuki.database.data_tok... | StarcoderdataPython |
3245533 | # vim: set fileencoding=utf-8
# <NAME> <<EMAIL>>
#
# HICA - Host integrated container applications
#
# MIT License (C) 2015
from base.hica_base import *
class BindUsersGroupsInjector(HicaInjector):
def get_description(self):
return "Bind mounts users and groups into the container"
def get_config_key(self):
... | StarcoderdataPython |
1609340 | <reponame>mtholder/taxalotl<gh_stars>0
#!/usr/env python
"""Adapter for calling gnparser
Adapted based on instructions on
https://medium.com/learning-the-go-programming-language/calling-go-functions-from-other-languages-4c7d8bcc69bf
"""
import ctypes
import json
import os
_notfound_message = """LIBGNPARSER_FILEPA... | StarcoderdataPython |
3289489 | import numpy as np
import numpy.linalg as la
import numpy.random as npr
from functools import reduce
import matplotlib.pyplot as plt
def mdot(*args):
"""Multiple dot product."""
return reduce(np.dot, args)
def sympart(A):
"""Return the symmetric part of matrix A."""
return 0.5*(A+A.T)
def lqr(A, B... | StarcoderdataPython |
174009 | from tkinter import *
import datetime
import time
import pyttsx3
synthesizer = pyttsx3.init()
window=Tk()
Alarm_time=""
window.config(pady=20)
window.geometry("300x300")
window.title("Alarm")
entry=Entry()
entry.insert(0,"hh:mm:ss")
entry.pack()
label_emtpy=Label(text="")
label_emtpy.pack()
def settim... | StarcoderdataPython |
3265422 | <gh_stars>0
from typing import Type
from auth.exceptions import WrongLoginCredentials
from base import settings
from base.exceptions import ObjectDoesNotExists
from base.manager import BaseManager, BaseManagerModel
from passlib.hash import pbkdf2_sha256
from . import schemas
class AuthManager(BaseManager):
def... | StarcoderdataPython |
3354086 | <reponame>lrivallain/pyvcloud
# VMware vCloud Director Python SDK
# Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | StarcoderdataPython |
3259126 | <reponame>ValRat/raster-vision
from copy import deepcopy
import rastervision as rv
from rastervision.data.vector_source.vector_source_config import (
VectorSourceConfig, VectorSourceConfigBuilder)
from rastervision.data.vector_source.vector_tile_vector_source import (
VectorTileVectorSource)
from rastervision.... | StarcoderdataPython |
60172 | #-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import os.path as path
from bes.common.check import check
from bes.common.string_util import string_util
from bes.fs.file_util import file_util
from bes.fs.temp_file import temp_file
from .git import git
from .git_address_util ... | StarcoderdataPython |
188326 | #!/usr/bin/env python3
import argparse
from Bio import SeqIO
def annotate_orfs(orfs):
"""
Takes a multifaste containing ORFs predicted by ORFfinder
and modify the header to have the same format as NCBI
proteome fasta.
0-based index from ORFfinder is changed to 1-based index.
>lcl|ORF5_NC_XXX... | StarcoderdataPython |
1600824 | <filename>Independent Component Analysis.py
import csv
from mne.preprocessing import (ICA)
from mne import Epochs, pick_types
from mne.channels import make_standard_montage
from mne.io import concatenate_raws, read_raw_edf
from mne.datasets import eegbci
import numpy as np
allICAs = []
subject = []
chosen = ... | StarcoderdataPython |
30287 | <filename>scripts/devops_tasks/trust_proxy_cert.py
import requests
import os
EXISTING_ROOT_PEM = requests.certs.where()
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
LOCAL_DEV_CERT = os.path.abspath(os.path.join(root_dir, 'eng', 'common', 'testproxy', 'dotnet-devcert.crt'))
COM... | StarcoderdataPython |
1731970 | <gh_stars>1-10
# ------------------------------------------------------------------------------
# Mari Extension Pack Importer
# Copyright (c) 2014 Mari Ideascale. All Rights Reserved.
# ------------------------------------------------------------------------------
# File: initExtensionPack.py
# Description: Main scrip... | StarcoderdataPython |
3227161 | <filename>sensor_feed/plant_control.py
"""A controller for watering a plant.
This acts a both a source (current output state) and a sink (receives sensor
data to act on).
"""
import atexit
import logging
from threading import Lock, Timer
from RPi import GPIO
from sensor_feed.sensor import SleepingSensor
from sensor_f... | StarcoderdataPython |
4819944 | from abc import ABC, abstractmethod
from typing import Dict
from sources.source_abstract import AbstractSource
from collections import namedtuple
ParamInfo = namedtuple("Param", ["type", "description", "required"])
# For sources that need a while to initialize before being used
# Used as a mixin class
class Factory... | StarcoderdataPython |
3309853 | <filename>client.py<gh_stars>1-10
#!/usr/bin/python
"""Usage: ./client.py [-hced]
Options:
-h, --help show this help message
-c, --configure Run first-time configuration
-e, --encrypt Run the prePush sequence
-d, --decrypt Run the postPull sequence
"""
from Crypto.Cipher import AES
from Cryp... | StarcoderdataPython |
80689 | #<NAME>
from sklearn import preprocessing
import matplotlib.pyplot as plt
import numpy as np
from sklearn.cluster import KMeans
# Data set
# Datos de 13/02/2020 a 10/11/2020
# De acuerdo con: https://tablerocovid.mspas.gob.gt/
# Regiones de acuerdo con: https://aprende.guatemala.com/historia/geografia/regiones-de-gua... | StarcoderdataPython |
106066 | <reponame>Wooden-Robot/spider-practice<filename>zhihulogin.py
import requests
from bs4 import BeautifulSoup
# 构造Request headers
agent = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, ' \
'like Gecko) Chrome/48.0.2564.116 Safari/537.36'
headers = {
'User-Agent': agent
}
s = requests.sessio... | StarcoderdataPython |
3202111 | import cv2
from image_morphing.np import np, GPU
from image_morphing.utils import load_points, resize_v
from image_morphing.render import render_animation
from image_morphing.optimize_v import adam
from image_morphing.quadratic_motion_path import adam_w
import os
def image_morphing(img0_path, img1_path, p0_path, p1_pa... | StarcoderdataPython |
74946 | nome = input('\nInsira seu nome: \n')
if 'SILVA' in nome.upper():
print('O seu nome tem SILAVA\n')
else:
print('Você não faz parte da família SILVA\n') | StarcoderdataPython |
3281533 | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
3314755 | <filename>doctable/connectengine.py
import pandas as pd
import sqlalchemy# as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import os
from datetime import datetime
import typing
from typing import Union, Mapping, Sequence, Tuple, Set, List
#from sqlalchemy.sql import... | StarcoderdataPython |
1677400 | from flask import Blueprint, render_template, redirect, request, g, session, url_for
import os
from pathlib import Path
import json
from datetime import date
from conexao import *
import shutil
admin_dp = Blueprint(
'profile',
__name__,
template_folder='templates',
static_folder='static',
static_u... | StarcoderdataPython |
3323980 | import os
import requests
def get_cache_folder_path():
pass
def get_session(session_id: str) -> requests.Session:
session = requests.Session()
session.cookies["session"] = session_id
return session
| StarcoderdataPython |
15757 | <filename>ppocr/utils/special_character.py
# -*- coding: utf-8 -*
# Copyright (c) 2020 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:... | StarcoderdataPython |
122212 | <reponame>wixette/font-to-3d-models
"""Generates 3D models for ASCII letters or UNICODE glyphs based on a font file.
Usage:
blender -b -P font_to_3d_models.py -- <font_path> <output_dir>
blender -b -P font_to_3d_models.py -- <font_path> <output_dir> <letters>
<font_path>: The path to the font file. Both TTF and OTF ... | StarcoderdataPython |
1709276 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Utility functions for zazu."""
try:
import readline # NOQA
except ImportError:
# This will be available on Windows
import pyreadline # NOQA
import zazu.imports
zazu.imports.lazy_import(locals(), [
'builtins',
'click',
'concurrent.futures',
'conte... | StarcoderdataPython |
3263080 | <filename>NS.py<gh_stars>1-10
import csv
from call import name
with open('Nova_Scotia_Baby_Names.csv') as Nova_Scotia_Baby_Names:
reader = csv.reader(Nova_Scotia_Baby_Names)
NSYears = []
frequencyFNS = {}
frequencyMNS = {}
for row in reader:
if row[0] not in NSYears:
NSYears.app... | StarcoderdataPython |
189060 | <filename>setup.py<gh_stars>1-10
#! /usr/bin/env python
from distutils.core import setup
setup(name='twittytwister',
version='0.1',
description='Twitter client for Twisted Python',
author='<NAME>',
author_email='<EMAIL>',
url='http://github.com/dustin/twitty-twister/',
license='MIT',
platf... | StarcoderdataPython |
1699983 | <reponame>ig-rudenko/CbP
import shutil
import os
from datetime import datetime
from cbp.core import logs
import pexpect
timed = str(datetime.now())[0:10] # текущая дата 'yyyy-mm-dd'
def elog(info, ip, name):
logs.error_log.error("%s-> %s: %s" % (ip.ljust(15, '-'), name, info))
def tftp_upload(telnet_session,... | StarcoderdataPython |
193981 | <reponame>bburan/psiexperiment
import logging
log = logging.getLogger(__name__)
from functools import partial
import operator as op
import threading
import numpy as np
from atom.api import Enum, Bool, Typed, Property
from enaml.application import deferred_call
from enaml.qt.QtCore import QTimer
from enaml.workbench.... | StarcoderdataPython |
3223026 | <reponame>edasgupta/qiskit-terra<gh_stars>1-10
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www... | StarcoderdataPython |
94445 | # -*- coding: utf-8 -*-
"""
@FileName : data_conversion.py
@Description : 数据转换
@Author : 齐鲁桐
@Email : <EMAIL>
@Time : 2019-05-07 11:13
@Modify : None
"""
from __future__ import absolute_import, division, print_function
import os
import fairy.tail as ft
from .data_base import open_image
de... | StarcoderdataPython |
166867 | <reponame>DeSireFire/Fastapi-sample
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author : RaXianch
# CreatDATE : 2021/8/21
# CreatTIME : 20:15
# Blog : https://blog.raxianch.moe/
# Github : https://github.com/DeSireFire
__author__ = 'RaXianch'
from typing import List
import uvicorn
import time
from fast... | StarcoderdataPython |
1660287 | from src import listofcoins
import requests
import json
#Inputting number of coins
n = int(input("Enter the number of coins:"))
#Creating request from api and print coins
listofcoins(n)
| StarcoderdataPython |
3246377 | <filename>spacy_lookups_data/tests/test_grc.py
import pytest
@pytest.mark.parametrize(
"string,lemma",
[
("ἄνδρα", "ἀνήρ"),
("μοι", "ἐγώ"),
("ὃς", "ὅς"),
("πολλὰ", "πολύς"),
("καρδίαν", "καρδία"),
],
)
def test_grc_lemmatizer_lookup_assigns(grc_nlp, string, lemma):
... | StarcoderdataPython |
1782797 | from django.shortcuts import render
from django.views import View
from django.views.generic import TemplateView
from app.models import *
from app.publicacoes_com_metadados import *
import re, json
# Lista de Entidades Possíveis
entity_list = [ 'ADV', 'ADVS',
'ADVOGADA', 'ADVOGADO',
'AGR... | StarcoderdataPython |
3232049 | from PyQt5.QtWidgets import QTreeWidgetItem
class TechCapex:
def __init__(self):
pass
@staticmethod
def tech_compare(tech1: QTreeWidgetItem, tech2: QTreeWidgetItem, data: dict):
try:
name1 = tech1.text(0)
name2 = tech2.text(0)
if not name1 == name2:
... | StarcoderdataPython |
1681770 | {
"targets": [
{
"target_name": "telldus",
"sources": [ "telldus.cc" ],
"conditions": [
['OS=="mac"', {
'include_dirs': [
'/Library/Frameworks/TelldusCore.framework/Headers'
],
'libraries': [
'/Library/Frameworks/TelldusCore.framewo... | StarcoderdataPython |
1764429 | <gh_stars>1-10
import os
import logging
from django.http import HttpResponse
from django.shortcuts import redirect
from django.views.generic import View
from django.conf import settings
class FrontendAppView(View):
"""
Serves the compiled frontend entry point (only works if you have run `yarn
build`).
... | StarcoderdataPython |
4811299 | <filename>guest_client.py
# Puzzle client helper program
import socket
import sys
import os
import re
if len(sys.argv) != 4:
print "Usage: python guest_client.py <question name> <question answer> <email>"
sys.exit(0)
HOST = 'localhost' # The remote host
PORT = 3490 # The same port as used by the server
... | StarcoderdataPython |
3300792 | import os
from os.path import abspath, dirname, join
import dj_database_url
from .base import * # noqa
DEBUG = False
PROJECT_ROOT = os.environ.get("PROJECT_ROOT") or dirname(dirname(abspath(__file__)))
DATABASES = {
"default": dj_database_url.config(
default="sqlite:///%s" % (join(PROJECT_ROOT, "geweb.... | StarcoderdataPython |
3276108 | import datetime
import math
import pytz
import re
import time
from django.conf import settings
from django.core.mail import EmailMessage
from django.core.management.base import BaseCommand
import pandas as pd
from bs4 import BeautifulSoup
from selenium import webdriver
from ...models import Gateway, Query, Sensor, T... | StarcoderdataPython |
4833476 | <filename>p2o.py
"""Get latest posts from Pinboard and create a new blog post."""
import collections
import cStringIO
import datetime
import os
import re
import sys
import gflags
import requests
FLAGS = gflags.FLAGS
gflags.DEFINE_string(
'octopress', '.', 'location of octopress directory')
gflags.DEFINE_integer... | StarcoderdataPython |
3350902 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 23 18:54:24 2020
@author: hp
"""
import pandas as pd
from sklearn.utils import resample
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.model_selection import train_test_split as tts
f... | StarcoderdataPython |
3334805 | <reponame>kevinAlfsen/RASH-Bachelor-Thesis
#Standard modules
import time
import matplotlib.pyplot as plt
import os
import numpy as np
import threading
import queue
#RASH modules
import masterboard
import config
import trajectory as trj
class InputTask:
def __init__(self, trajectory_queue):
self.trajector... | StarcoderdataPython |
24764 | import pymongo
from bson.objectid import ObjectId
# mongo 增加
def main():
client = pymongo.MongoClient(host='172.16.17.32', port=27017)
db = client.test
collection = db.students
# 插入一条数据
student = {
'id': '20170101',
'name': 'Kevin',
'age': 20,
'gender': 'male'
... | StarcoderdataPython |
1768816 | print("assignment #1\n")
def format_address(address_string):
x = address_string.split()
return "house number {} on street named {}".format(x[0],x[1]+" "+x[2])
print(format_address("123 Main Street"))
print(format_address("1001 1st Ave"))
print(format_address("55 North Center Drive"))
print("assignment #2\n")
d... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.