id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
152011 | #!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | StarcoderdataPython |
1627792 | <filename>backup-23.09.2021/core/data_generator.py<gh_stars>0
import yaml
import click
import pickle
import argparse
import pandas as pd
import numpy as np
from os import listdir
from os.path import isfile, join
from sklearn.manifold import TSNE
class LoadData:
def __init__(self, name, embedding, fitness_path, ... | StarcoderdataPython |
1714686 | <filename>authcheck/app/common/util.py
import re
import os
import json
import time
import pickle
from app.conf.conf import *
from app.model.model import *
from app.model.exception import *
from flask import request, render_template
from mongoengine import Document
def validate_url(u: str):
"""
校... | StarcoderdataPython |
1737261 | from turtle import Turtle, Screen
import random
screen = Screen()
screen.setup(width=500, height=400)
turtle_colors = ["red", "blue", "green", "orange", "yellow", "purple"]
starting_line = [-125, -75, -25, 25, 75, 125]
list_of_turtles = []
# init turtles
for num_of_turtles in range(0, 6):
n_turtles = Turtle(shape... | StarcoderdataPython |
3365905 | from django.db import models
from django.utils import timezone
from projects.models.project import Project
class TechnicalSheet(models.Model):
class Meta:
verbose_name = 'technicalsheet'
verbose_name_plural = 'technicalsheets'
created = models.DateTimeField(editable=False, auto_now_... | StarcoderdataPython |
1731862 | <filename>leetcode/143-Reorder-List/ReorderList_001.py
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @return {void} Do not return anything, modify head in-place instead.
def re... | StarcoderdataPython |
1632191 | # run this from terminal with madminer stuff installed to be safe
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from madminer.sampling import combine_and_shuffle
import glob
# MadMiner output
logging.basicConfig(
format='%(asctime)-5.5s %(name)-20.20s %(levelna... | StarcoderdataPython |
171485 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Review(models.Model):
comment = models.CharField(max_length=1000)
conversation = models.IntegerField()
title = models.CharField(max_length=100)
style = models.IntegerField()
satisfaction = models.IntegerField()
wo... | StarcoderdataPython |
1756109 | from deepnlpf.notifications.email import Email
email = Email()
email.send() | StarcoderdataPython |
3230171 | import robocup
import constants
import main
import math
import skills.touch_ball
import skills._kick
import skills.pass_receive
## AngleReceive accepts a receive_point as a parameter and gets setup there to catch the ball
# It transitions to the 'aligned' state once it's there within its error thresholds and is stead... | StarcoderdataPython |
95337 | # vim: set filetype=python fileencoding=utf-8:
# -*- coding: utf-8 -*-
#============================================================================#
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may ... | StarcoderdataPython |
1688939 | <reponame>mayneyao/notion-bill
import fire
import pandas as pd
class PersonBill:
def __init__(self, name):
self.name = name
self.income = {}
self.payment = {}
self.need_pay = {}
self.items = []
def print_payment(self):
for name, money in self.payment.items():
... | StarcoderdataPython |
4808656 | from output.models.ms_data.regex.re_i12_xsd.re_i12 import (
Regex,
Doc,
)
__all__ = [
"Regex",
"Doc",
]
| StarcoderdataPython |
4803872 | import numpy as np
from scipy import stats, special
from abc import ABC
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
class component(ABC):
"""Abstract base class to rerepsent a galaxy component
A component is specified by it's joint density p(t,x,v,z) over stellar age
t, 2D posi... | StarcoderdataPython |
174720 | # -*- coding: utf-8 -*-
"""
utilities.
"""
from __future__ import print_function, unicode_literals
import os
def make_dir(abspath):
"""
Make an empty directory.
"""
try:
os.mkdir(abspath)
print("Made: %s" % abspath)
except: # pragma: no cover
pass
def make_file(abspath... | StarcoderdataPython |
1770044 | <reponame>senavs/rsaEcryption
import random
def prime_number(number):
if number == 1:
return False
i = 2
while i * i <= number:
if number % i == 0:
return False
i += 1
return True
def random_prime_number(length):
while True:
n = random.randint(1 * pow(10... | StarcoderdataPython |
3223043 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
name = "java-service-wrapper"
source = "https://aur.archlinux.org/java-service-wrapper.git"
| StarcoderdataPython |
3357411 | <reponame>smallrobots/Ev3TrackedExplorer_MarkII
#################################################################################################
# ev3_remoted.ev3_server class #
# Version 1.0 ... | StarcoderdataPython |
3272038 | import torch.nn as nn
from .single import ScaledDotProductAttention
class MultiHeadedAttention(nn.Module):
"""
Take in model size and number of heads.
"""
def __init__(self, h, d_in,d_out, dropout=0.3):
super().__init__()
assert d_out % h == 0
# We assume d_v always equals d_... | StarcoderdataPython |
1635997 | import os, py
if os.name != 'nt':
py.test.skip('tests for win32 only')
from rpython.rlib import rwin32
from rpython.tool.udir import udir
def test_get_osfhandle():
fid = open(str(udir.join('validate_test.txt')), 'w')
fd = fid.fileno()
rwin32.get_osfhandle(fd)
fid.close()
py.test.raises(OSErro... | StarcoderdataPython |
1620404 | <reponame>OpenVessel/RedTinSaintBernard-for-BraTS2021-challenge
path_to_single = r"E:\Datasets\BraTS challenge\BraTS2021_00621"
path_to_BraTS2021 = "E:\Datasets\BraTS challenge\RSNA_ASNR_MICCAI_BraTS2021_TrainingData"
## What is flair
## What is seg
## What is t1
## What is t1ce
## What is t2?
## So we need to u... | StarcoderdataPython |
1760842 | from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.crypto import get_random_string
from django.core.exceptions import ObjectDoesNotExist
from .models import Game
from .forms import GameForm, JoinGameForm
# Create your views here.
def home... | StarcoderdataPython |
3307187 | <reponame>diogolopes18-cyber/MODSI
#!/usr/bin/env python3
from dotenv.main import load_dotenv
from flask import Flask, render_template, flash, request, redirect, url_for, send_from_directory, session, abort, Blueprint
import database_conn as db
# App context
orientador = Blueprint('orientador', __name__)
@orientad... | StarcoderdataPython |
1748628 | # Generated by Django 2.1.5 on 2019-02-15 08:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_employee_company_benifits'),
]
operations = [
migrations.AlterField(
model_nam... | StarcoderdataPython |
3223321 | from .UNet_3D import UNet3D | StarcoderdataPython |
1615919 | import sand_python
from sand_python.sand_exceptions import SandError
from sand_python.sand_service import SandService
class SandMiddleware(object):
def __init__(self, get_response=None):
self.get_response = get_response
def process_request(self, request):
sand = SandService('http://sand-py-tes... | StarcoderdataPython |
1779948 | <gh_stars>1-10
# -----------------------------------------------------------------------------
def filter_list(values, excludes):
"""
Filter a list of values excluding all elements from excludes parameters and return the new list.
Arguments:
values : list
excludes : list
Returns:
... | StarcoderdataPython |
1771115 | def _LCG(a, z, c, m, n):
sequence = [z]
for _ in range(n):
number = (a * sequence[len(sequence) - 1] + c) % m
sequence.append(number)
return sequence[1:]
def LCG(cli, name):
cli.out(f'Вы выбрали [magenta]{name}[/magenta].')
a = cli.int('Введите множитель (a): ')
z = cli.int('Вв... | StarcoderdataPython |
4823827 | <gh_stars>1-10
import play_video
import time
movie_1 = play_video.Play_vdo()
movie_1.play()
time.sleep(10)
movie_1.stop_play() | StarcoderdataPython |
3332509 | <gh_stars>1-10
from typing import List
from transmart_loader.collection_visitor import CollectionVisitor
from transmart_loader.console import Console
from transmart_loader.loader_exception import LoaderException
from transmart_loader.transmart import TreeNode, DataCollection, Observation, \
Patient, Visit, TrialVi... | StarcoderdataPython |
3368757 | from restfly.endpoint import APIEndpoint
from box import BoxList
class CloudSandboxAPI(APIEndpoint):
def get_quota(self):
"""
Returns the Cloud Sandbox API quota information for the organisation.
Returns:
:obj:`dict`: The Cloud Sandbox quota report.
Examples:
... | StarcoderdataPython |
199230 | <reponame>frcl/jupytext<filename>tests/test_read_write_functions.py
from io import StringIO
from pathlib import Path
import nbformat
from nbformat.v4.nbbase import new_markdown_cell, new_notebook
import jupytext
from jupytext.compare import compare
def test_simple_hook(tmpdir):
nb_file = str(tmpdir.join("notebo... | StarcoderdataPython |
4820550 | <filename>NU_20-21/4.py<gh_stars>0
#Be sure to upload your work today for your "attendance/participation" grade.
# I will not be grading your work in detail, simply 1 if submitted, 0 if not.
# After you finsh the problems below, please work on Assignment 1.
#I have provided 2 asserts for each already. You should unc... | StarcoderdataPython |
124198 | <filename>libs/tools/json.py<gh_stars>0
from functools import wraps
from flask import jsonify, request
from jsonschema import validate
from jsonschema.exceptions import ValidationError
from werkzeug.exceptions import BadRequest
from importlib import import_module
import logging
def validate_schema(schema_name: str):
... | StarcoderdataPython |
3376916 | <filename>smsAlert/__init__.py
# -*- coding: utf-8 -*-
__author__ = 'Prashant'
__version__ = '0.1.0'
from .smsAlert import smsAlertMsg | StarcoderdataPython |
194302 | # -*- coding: utf-8 -*-
##########################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-e... | StarcoderdataPython |
1773459 | <filename>mayan/apps/events/tests/test_views.py
from django.contrib.contenttypes.models import ContentType
from mayan.apps.acls.classes import ModelPermission
from mayan.apps.documents.tests.base import GenericDocumentViewTestCase
from mayan.apps.messaging.events import event_message_created
from mayan.apps.messaging.... | StarcoderdataPython |
81988 | <reponame>simone-pignotti/DnaChisel
from .NoSolutionError import NoSolutionError
from .DnaOptimizationProblem import DnaOptimizationProblem
from .CircularDnaOptimizationProblem import CircularDnaOptimizationProblem
__all__ = [
"NoSolutionError",
"DnaOptimizationProblem",
"CircularDnaOptimizationProblem"
]
| StarcoderdataPython |
1760780 | <gh_stars>1-10
import os
import subprocess as sp
from shlex import split
from pathlib import Path
__version__ = '0.3'
GITHUB_EVENT_NAME = os.environ['GITHUB_EVENT_NAME']
# Set repository
CURRENT_REPOSITORY = os.environ.get('GITHUB_REPOSITORY', '')
# TODO: How about PRs from forks?
TARGET_REPO = os.environ.get('INPU... | StarcoderdataPython |
60981 | import json
import psycopg2
import os
from psycopg2._psycopg import IntegrityError
from psycopg2.errorcodes import UNIQUE_VIOLATION
from logging import getLogger
def create_db_connection():
return psycopg2.connect(os.environ['DB_CONNECTION_STRING'])
class RunInTransaction:
def __init__(self, connection):
... | StarcoderdataPython |
3312885 | #!/usr/bin/env python
import unittest
import boostertest
class TestForestDelete(boostertest.BoosterTestCase):
""" Test the forest-delete action """
def setUp(self):
""" Set the action and other commonly used fixture data """
self.params = {}
self.params['action'] = "forest-delete"
... | StarcoderdataPython |
3326454 | <filename>dns/qcloud.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import time
import urllib
import base64
import hashlib
import hmac
import json
if sys.version_info < (3,0):
import urllib2
import urllib
else:
import urllib.request as urllib2
import urllib.parse as urllib
root... | StarcoderdataPython |
186181 | <filename>examples/vision/utils.py
import os
import torch
import time
import pickle
import logging
import lmdb
from contextlib import contextmanager
from io import StringIO
from constants import _STALE_GRAD_SORT_, _ZEROTH_ORDER_SORT_, _FRESH_GRAD_SORT_, _MNIST_
import torch.utils.data as data
from qmcorder.sort.utils i... | StarcoderdataPython |
1716206 | # -*- coding: utf-8 -*-
"""
Created on Mon May 28 20:21:27 2018
@author: Administrator
"""
import numpy as np
from MyLibrary import *
FPS=120
screenwidth=288
screenheight=512
fontsize=30
player_filename="players.png"
player_frame_width=48
player_frame_height=48
player_frame_num=4
base_filename="base.... | StarcoderdataPython |
3263197 | from classes import ELF
path = "/tmp/file.elf64"
elf = ELF(path)
print(elf.executable_header.__dict__) | StarcoderdataPython |
3229799 | # Generated by Django 3.2.4 on 2021-07-29 21:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Hike',
new_name='HikeModel',
),
]
| StarcoderdataPython |
3319155 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-14 20:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import prosopography.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('letters', '... | StarcoderdataPython |
1668866 | <filename>presqt/targets/gitlab/utilities/delete_gitlab_project.py<gh_stars>1-10
import requests
def delete_gitlab_project(project_id, token):
"""
Delete the given project from Gitlab.
Parameters
----------
project_id: str
The ID of the project to delete.
token: str
The user's... | StarcoderdataPython |
199190 | LIST_WORKFLOWS_GQL = '''
query workflowList {
workflowList {
edges{
node {
id
name
objectType
initialPrefetch
initialState {
id
name
}
initialTransition {
id
name
}
}
}
}
}
'''
LIST_STATES_GQL... | StarcoderdataPython |
104167 | <filename>GA_FeatureSelection.py
import numpy
import matplotlib.pyplot
import sklearn.svm
"""
Reference:
This class is adapted from a GA Feature Selection library:
ahmedfgad/FeatureReductionGenetic
Credit to the original author.
Github Link: https://github.com/ahmedfgad/FeatureReductionGenetic.git
Ori... | StarcoderdataPython |
1668058 | """WxPython-based implementation of the Eelbrain ui functions."""
from ..._wxgui import wx, get_app
def ask_saveas(title, message, filetypes, defaultDir, defaultFile):
"""See eelbrain.ui documentation"""
app = get_app()
return app.ask_saveas(title, message, filetypes, defaultDir, defaultFile)
def ask_di... | StarcoderdataPython |
3204090 | x="Hello"
y="World"
z="!"
print (x+" "+y" "+z)
| StarcoderdataPython |
3329951 | # http://stackoverflow.com/questions/14061195/how-to-get-transcript-in-youtube-api-v3
# http://video.google.com/timedtext?lang={LANG}&v={VIDEOID}
import config
import requests
import untangle
from datetime import datetime
import time
import pymysql.cursors
import sys
def printDateNicely(timestamp):
reg_format_dat... | StarcoderdataPython |
98131 | <filename>aiomodrinth/models/utils.py
from datetime import datetime
from abc import ABC, abstractmethod
def string_to_datetime(date: str, format_: str = None) -> datetime:
if format_ is None:
format_ = "%Y/%m/%d %H:%M:%S.%f"
dt = datetime.strptime(date.replace('-', '/').replace('T', ' ').replace('Z', ... | StarcoderdataPython |
172472 | <filename>utils/profiling.py
# -*- coding: utf-8 -*-
import sys
import time
import torch
from functools import wraps
import numpy as np
def get_gpumem():
return torch.cuda.memory_allocated() / 1024. / 1024.
def get_cputime():
return time.perf_counter()
def seqstat(arr):
a = np.array(arr)
return '[ {... | StarcoderdataPython |
1786902 | <filename>src/buildstream/_options/optionflags.py
#
# Copyright (C) 2017 Codethink Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | StarcoderdataPython |
1743899 | <gh_stars>0
from dal import autocomplete
from dal_select2.widgets import Select2Multiple
from dal_select2_taggit.widgets import TaggitSelect2
from django.db import models
from django.utils import timezone
from django.utils.text import slugify
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelclus... | StarcoderdataPython |
1603113 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# #*** <License> ************************************************************#
# This module is part of the program FFW.
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/bsd_3c.html>.
# #*** </License> *******************... | StarcoderdataPython |
164744 | <filename>tests/test_socialbot.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_socialbot
----------------------------------
Tests for `socialbot` module.
"""
import unittest
import threading
import requests
from socialbot.main import SlackBotHandler
from BaseHTTPServer import BaseHTTPRequestHandler, HTTP... | StarcoderdataPython |
4831570 | from typing import Any, Dict, List, Union
from xpanse.const import V2_PREFIX
from xpanse.endpoint import ExEndpoint
from xpanse.error import UnexpectedValueError
from xpanse.iterator import ExResultIterator
class CertificatesEndpoint(ExEndpoint):
"""
Part of the Assets v2 API for handling asset certificates.... | StarcoderdataPython |
1602396 | <reponame>leddartech/pioneer.common<gh_stars>1-10
from pioneer.common import plane, linalg
from pioneer.common.logging_manager import LoggingManager
from numpy.matlib import repmat
import math
import numpy as np
import os
import transforms3d
def grid(v, h, v_from, v_to, h_from, h_to, dtype = np.float32):
'''
... | StarcoderdataPython |
1780276 | <filename>backend/api/urls.py
from .apiviews import DigitsViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'digits', DigitsViewSet)
urlpatterns = router.urls
| StarcoderdataPython |
180918 | <reponame>NumberAI/python-bandwidth-iris
#!/usr/bin/env python
from iris_sdk.models.base_resource import BaseData
from iris_sdk.models.data.telephone_number_list import TelephoneNumberList
from iris_sdk.models.maps.ord.existing_search_order import \
ExistingSearchOrderMap
from iris_sdk.models.data.reservation_list... | StarcoderdataPython |
76706 | <reponame>LucasBoTang/Piecewise_Affine_Fitting<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
from matplotlib import pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from sklearn.linear_model import LinearRegression
import cv2
import numpy as np
import heuristics
import ilp
import util... | StarcoderdataPython |
1613142 | <reponame>joncotton/armstrong.hatband<filename>armstrong/hatband/widgets/ckeditor.py<gh_stars>0
from django.forms import widgets
from django.conf import settings
class CKEditorWidget(widgets.Textarea):
class Media:
js = (''.join((settings.STATIC_URL, "ckeditor/ckeditor.js")),)
def __init__(self, att... | StarcoderdataPython |
3398687 | # -*- coding: utf-8 -*-
import torch
import argparse
import os
import sys
import random
import numpy as np
from os.path import join, dirname, abspath
#parser = argparse.ArgumentParser(description="Run scan-net and save to given location")
#parser.add_argument('--path', dest='path', default='./scan_model_ICO.pth')
mp0... | StarcoderdataPython |
195010 | n = int(input())
a = n // 365
n = n - a*365
m = n // 30
n = n - m*30
d = n
print('{} ano(s)'.format(a))
print('{} mes(es)'.format(m))
print('{} dia(s)'.format(d))
| StarcoderdataPython |
1645030 | import discord
from libs.utils import get_now_timestamp_jst
# 共通で利用するカスタム embed を返します
def get_custum_embed() -> discord.Embed:
embed = discord.Embed()
embed.timestamp = get_now_timestamp_jst()
return embed
| StarcoderdataPython |
3335484 | <filename>check/tests/__init__.py
#
# Tests for the CellML validation methods
#
| StarcoderdataPython |
10935 | <filename>mne/time_frequency/psd.py
# Authors : <NAME>, <EMAIL> (2011)
# <NAME> <<EMAIL>>
# License : BSD 3-clause
import numpy as np
from ..parallel import parallel_func
from ..io.pick import _pick_data_channels
from ..utils import logger, verbose, _time_mask
from ..fixes import get_spectrogram
from .multi... | StarcoderdataPython |
1730138 | <filename>littlebrother/test/helpers.py
"""Test helpers."""
import os.path
from stenographer import CassetteAgent
from twisted.internet import reactor
from twisted.web.client import (ContentDecoderAgent, RedirectAgent,
Agent, GzipDecoder)
def cassette_path(name):
"""Return the f... | StarcoderdataPython |
1738568 | """
You're given two integers, n and m.
Find position of the rightmost pair of equal bits in their binary representations (it is guaranteed that such a pair exists),
counting from right to left.
Return the value of 2position_of_the_found_pair (0-based).
Example
For n = 10 and m = 11, the output should be
equalPairOf... | StarcoderdataPython |
112633 | import tensorflow as tf
import os
from tensorflow.python.framework import graph_util
from tensorflow.python.platform import gfile
def show_help():
help(tf.contrib.lite.TocoConverter)
# 本地的pb文件转换成TensorFlow Lite (float)
def pb_to_tflite(pb_file, save_name, input_arrays, output_arrays):
# graph_def_file = "./... | StarcoderdataPython |
4826455 | <filename>gistmagic/__init__.py<gh_stars>0
__version__ = '0.0.1'
from .gistmagic import GistMagic
def load_ipython_extension(ipython):
token = input("\nGitHub token: ")
gistmagic = GistMagic(ipython, token)
ipython.register_magics(gistmagic)
| StarcoderdataPython |
3347256 | <filename>app/models/mongo_base.py<gh_stars>0
"""
@File : mongo_base.py
@Author: GaoZizhong
@Date : 2020/6/11 14:22
@Desc : mongo模型类
"""
import datetime
from flask_mongoengine import MongoEngine
mongo_db = MongoEngine()
class BaseModel(object):
"""
所有模型基类
"""
createDate = mongo_db... | StarcoderdataPython |
1631059 | <gh_stars>1-10
from flask import Blueprint,request,redirect,flash
from . import db # Importing Database Variable
from .models import User # Importing User from models.py to access Name of User
from .models import Question
import uuid
# from flask.typing import StatusCode
askQuestion = Blueprint('askQuestion',__name__,... | StarcoderdataPython |
96219 | <reponame>adisakshya/pycrypto
"""
MODULE NAME: helper_cryptoid
Author: <NAME>
"""
from lists import list_symmetric_ciphers, list_asymmetric_ciphers
import codecs
from Crypto.Random import get_random_bytes
op_formats = ["", "base64", "hex"]
def save_result(text):
file_name = 'output.txt'
if input("\n... | StarcoderdataPython |
4813576 | import uuid
from sklearn.metrics import roc_curve, roc_auc_score
from exception_layer.generic_exception.generic_exception import GenericException as PlotlyDashException
from project_library_layer.initializer.initializer import Initializer
from data_access_layer.mongo_db.mongo_db_atlas import MongoDBOperation
from pr... | StarcoderdataPython |
1793422 | <reponame>AndrewWood94/WalkingSpeedPaper<filename>src/gps_reader_pkg/break_finder.py
"""
Finds breaks in gps tracks
"""
from PyQt5.QtCore import QVariant
import math
from qgis.core import QgsVectorLayer, QgsExpression, QgsExpressionContext, QgsExpressionContextUtils, QgsField
def get_segment_info(datalayer):
"""
... | StarcoderdataPython |
129835 | <reponame>D-Wolter/PycharmProjects
"""
CPF = 168.995.350-09
------------------------------------------------
1 * 10 = 10 # 1 * 11 = 11 <-
6 * 9 = 54 # 6 * 10 = 60
8 * 8 = 64 # 8 * 9 = 72
9 * 7 = 63 # 9 * 8 = 72
9 * 6 = 54 # 9 * 7 = 63
5 * 5 = 25 ... | StarcoderdataPython |
3243661 | <filename>apps/tool/apis/water_mark.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import math
from PIL import Image, ImageFont, ImageDraw, ImageEnhance, ImageChops
def add_mark(imagePath, mark, out, quality):
'''
添加水印,然后保存图片
'''
im = Image.open(imagePath)
image = mark(im)
name = os... | StarcoderdataPython |
4805265 | <reponame>Rounak40/Proxy-Scrapper-and-Scanner
# import modules
import requests
import json
from bs4 import BeautifulSoup
import re
from threading import Thread
global good_list
good_list = []
def get_links(proxy_type=None):
if proxy_type == "http":
data = open("site urls.txt").readlines()[0]
... | StarcoderdataPython |
3295957 | """
Bottleneck Transformers for Visual Recognition.
adapted from https://github.com/CandiceD17/Bottleneck-Transformers-for-Visual-Recognition
"""
import torch
from einops import rearrange
from torch import einsum, nn
try:
from distribuuuu.models import resnet50
except ImportError:
from torchvision.models impor... | StarcoderdataPython |
86510 | import os, json
from blockfrost import BlockFrostApi, ApiError
from blockfrost.utils import convert_json_to_object
hash = "8f55e18a94e4c0951e5b8bd8910b2cb20aa4d742b1608fda3a06793d39fb07b1"
xpub = "d507c8f866691bd96e131334c355188b1a1d0b2fa0ab11545075aab332d77d9eb19657ad13ee581b56b0f8d744d66ca356b93d42fe176b3de007d53e9c... | StarcoderdataPython |
1710112 | # =============================================================================
# SIMULATION-BASED ENGINEERING LAB (SBEL) - http://sbel.wisc.edu
#
# Copyright (c) 2019 SBEL
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# at https://opensource.org/licenses/BSD-3-... | StarcoderdataPython |
50820 | # login.txt should contain address on first line and app specific password on the second
#
# <EMAIL>
# <PASSWORD>
def sendEmail(subject, message_):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
with open("login.txt") as f:
login = f.read().... | StarcoderdataPython |
3228606 | import connexion
import six
from swagger_server.models.schedule_option import ScheduleOption # noqa: E501
from swagger_server import util
from sqlalchemy import exc
def add_schedule_option(body): # noqa: E501
"""Add a schedule_option to the classdeck
# noqa: E501
:param body: ScheduleOption object ... | StarcoderdataPython |
194527 | <filename>seldom/db_operation/mongo_db.py
try:
from pymongo import MongoClient
except ModuleNotFoundError:
raise ModuleNotFoundError("Please install the library. https://github.com/mongodb/mongo-python-driver")
class MongoDB:
def __new__(cls, host, port, db):
"""
Connect the mongodb datab... | StarcoderdataPython |
1769320 | <reponame>sergei-dyshel/tmux-clost
from lib.tmux import run
for i in xrange(100):
run(['display-message', '-p', '#{pane_id}'], cm=False)
# run(['send-keys', 'Escape'], cm=False)
# run(['list-keys'], cm=False)
| StarcoderdataPython |
1742367 | <gh_stars>1-10
# Copyright (C) 2021 <NAME>
# All Rights Reserved.
#
from aiohttp import ClientSession
from userbot import CMD_HELP
from userbot.events import register
async def get_nekos_img(args):
nekos_baseurl = "https://nekos.life/api/v2/img/"
if args == "random_hentai_gif":
args = "Random_hentai... | StarcoderdataPython |
1733034 | import degooged_tube.ytApiHacking as ytapih
import degooged_tube.config as cfg
from typing import Union, Tuple
from degooged_tube.subboxChannel import SubBoxChannel, ChannelLoadIssue, loadChannel, callReload
from degooged_tube import getPool
from degooged_tube.helpers import paginationCalculator
class EndOfSubBox(Exc... | StarcoderdataPython |
3330289 | <reponame>MaxStrange/nlp
"""
This module provides a command line interface for making graphs and charts of the data.
"""
import argparse
import betrayal
import matplotlib.pyplot as plt
import os
import sys
def plot_triplet(relationship):
"""
Plots the given triplet/relationship.
"""
fvs = [s.to_feature... | StarcoderdataPython |
3286834 | <gh_stars>0
# https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list/problem
import math
import os
import random
import re
import sys
class DoublyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
class Dou... | StarcoderdataPython |
1750626 | <reponame>aidotse/Team-rahma.ai
# coding=utf-8
"""regexp_editor - give a user feedback on their regular expression
"""
import re
import wx
import wx.stc
STYLE_NO_MATCH = 0
STYLE_MATCH = 1
STYLE_FIRST_LABEL = 2
STYLE_ERROR = 31
UUID_REGEXP = (
"[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa... | StarcoderdataPython |
3309221 | <reponame>sassoftware/conary
#
# Copyright (c) SAS Institute 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 app... | StarcoderdataPython |
111746 | <reponame>dsnk24/tts
import pyttsx3
engine = pyttsx3.init()
engine.say("Welcome to my text-to-speech program. Type the text you would like to convert below")
engine.runAndWait()
while True:
text = input('===>')
engine.say(text)
engine.runAndWait() | StarcoderdataPython |
129304 | '''
Copyright 2022 Airbus SAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | StarcoderdataPython |
3242987 | <reponame>marbogusz/pycarwings2
#!/usr/bin/env python
import pycarwings2
import time
from configparser import ConfigParser
import logging
import sys
import pprint
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
parser = ConfigParser()
candidates = ['config.ini', 'my_config.ini']
found = parser.read(candi... | StarcoderdataPython |
1605413 | import sys
import multiprocessing
from multiprocessing import Process
from multiprocessing.queues import Queue
import traceback
from entropy_search_terminal import main as entropy_search_main
def run_function_with_output_to_queue(func, args, queue):
stdout = sys.stdout
sys.stdout = queue
try:
fun... | StarcoderdataPython |
1784589 | """Provides the constants needed for component."""
SUPPORT_ALARM_ARM_HOME = 1
SUPPORT_ALARM_ARM_AWAY = 2
SUPPORT_ALARM_ARM_NIGHT = 4
SUPPORT_ALARM_TRIGGER = 8
SUPPORT_ALARM_ARM_CUSTOM_BYPASS = 16
SUPPORT_ALARM_ARM_VACATION = 32
CONDITION_TRIGGERED = "is_triggered"
CONDITION_DISARMED = "is_disarmed"
CONDITION_ARMED_H... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.