id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5060341 | # Python wrapper for starting wireless access points on Windows
import time
import logging
import os, sys
from optparse import OptionParser
class AP():
def __init__(self, opts):
self.SSID = opts.SSID
self.KEY = opts.KEY
def start_AP(self):
os.popen("netsh wlan set hostednetwork mode=allow ssid={0} key={1}"... | StarcoderdataPython |
8023841 | ''' Functions for working with shears
Terms used in function names:
* *mat* : array shape (3, 3) (3D non-homogenous coordinates)
* *aff* : affine array shape (4, 4) (3D homogenous coordinates)
* *striu* : shears encoded by vector giving triangular portion above diagonal
of NxN array (for ND transformation)
* *sadn*... | StarcoderdataPython |
12815866 | <filename>tests/full/test.py
from typing import Dict
from gura import ParseError
import unittest
import gura
import math
import os
class TestFullGura(unittest.TestCase):
file_dir: str
parsed_data: Dict
def setUp(self):
self.file_dir = os.path.dirname(os.path.abspath(__file__))
self.expect... | StarcoderdataPython |
6648743 | <filename>sql_app/crud.py
from sqlalchemy.orm import Session
from . import models, schemas
def db_commit(db: Session, db_model):
db.add(db_model)
db.commit()
db.refresh(db_model)
def get_user(db: Session, user_id: str):
return db.query(models.User).filter(models.User.uid == user_id).first()
def g... | StarcoderdataPython |
1937 | <filename>tests/python/correctness/simple_test_aux_index.py
#! /usr/bin/env python
#
# ===============================================================
# Description: Sanity check for fresh install.
#
# Created: 2014-08-12 16:42:52
#
# Author: <NAME>, <EMAIL>
#
# Copyright (C) 2013, Cornell Uni... | StarcoderdataPython |
9642290 | __all__ = ('tag', 'reader', 'gui', 'exceptions')
| StarcoderdataPython |
384174 | from ._docstrings import setup_anndata_dsp
from ._track import track
__all__ = ["track", "setup_anndata_dsp"]
| StarcoderdataPython |
159145 | """
Implementation of DDPG - Deep Deterministic Policy Gradient
Algorithm and hyperparameter details can be found here:
http://arxiv.org/pdf/1509.02971v2.pdf
The algorithm is tested on the Pendulum-v0 OpenAI gym task
and developed with tflearn + Tensorflow
Author: <NAME>
"""
from .tf_ddpg_agent import TensorFlow... | StarcoderdataPython |
8160772 | <reponame>jhkuang11/UniTrade
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-11-11 01:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import sorl.thumbnail.fields
class Migration(migrations.Migration... | StarcoderdataPython |
8138154 | <reponame>jgleissner/aws-parallelcluster-node
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apa... | StarcoderdataPython |
3273056 | import logging
from .get_class_that_defined_method import get_class_that_defined_method
from .now import now
log = logging.getLogger(__name__)
def time_method(f):
def wrap(*args, **kwargs):
defining_class = get_class_that_defined_method(f)
if defining_class is not None:
fn_descriptio... | StarcoderdataPython |
170690 | import pytest
import wtforms
from dmutils.forms.fields import DMRadioField
_options = [
{
"label": "Yes",
"value": "yes",
"description": "A positive response."
},
{
"label": "No",
"value": "no",
"description": "A negative response."
}
]
class RadioFor... | StarcoderdataPython |
26064 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..decoder import ConvDecoder
from ..encoder import build_encoder
from ..modules import conv, deconv
from ..similarity import CorrelationLayer
from ..utils import warp
from .build import MODEL_REGISTRY
@MODEL_REGISTRY.register()
class PWCNet(nn.M... | StarcoderdataPython |
11264259 | def demographyStep():
pass
| StarcoderdataPython |
8021668 | import json
import requests
import sys
from mako.template import Template
def main():
data = json.loads(open('commands.json').read())
text = Template(filename=sys.argv[1]).render(data=data)
payload = {'markup_type': 'html', 'markup': text, 'comments': 'y'}
requests.post('http://dev.bukkit.org/bukkit-pl... | StarcoderdataPython |
3376344 | <filename>mediaServer/exceptions.py
class JellyfinException(Exception):
pass
class JellyfinBadRequest(JellyfinException):
pass
class JellyfinUnauthorized(JellyfinException):
pass
class JellyfinForbidden(JellyfinException):
pass
class JellyfinResourceNotFound(JellyfinException):
pass
class Jelly... | StarcoderdataPython |
214445 | # -*- coding: utf-8 -*-
import json
import re
import requests
ACCESS_TOKEN = '7a285e8f48f85958dd04257966be69c6c57e519c'
BASE_URL = 'https://www-github3.cisco.com/api/v3'
PUBLIC_ACCESS_TOKEN = '4d3ad44f6df3447de0e977ad67b04a8787b8e03c'
PUBLIC_BASE_URL = 'https://api.github.com'
def get_session(access_token=None, ba... | StarcoderdataPython |
11318426 | <reponame>dwillis/openFEC<filename>tests/test_itemized.py
import datetime
import sqlalchemy as sa
from tests import factories
from tests.common import ApiBaseTest
from webservices.rest import api
from webservices.schemas import ScheduleASchema
from webservices.schemas import ScheduleBSchema
from webservices.resource... | StarcoderdataPython |
1752663 | import constants
import json
import requests
import pickle
import time
import re,sys
import string
from ip_modifier import change_ip
CRAWL_SUCCESS = 0
IP_BANNED = -1
OTHER_EXCEPTION = 1
class comment_crawler:
poi_id = 0
disable_cnt = 0
def __init__(self, poi_id):
self.poi_id = poi_id
... | StarcoderdataPython |
227619 | <filename>ec2_functions.py
import proxmox_api
import time
import paramiko
import json
import pexpect
# import subprocess
# from subprocess import Popen, PIPE, check_call
def vm_copy_and_setup(public_key, proxmox, vm_id):
proxmox.clone_vm("pve", 102, vm_id)
ready = False
#Wait until the vm is done clonin... | StarcoderdataPython |
1740848 | # -*- coding: utf-8 -*-
import os
import json
from pymatgen import MPRester
data = {}
with MPRester() as mpr:
for i, d in enumerate(
mpr.query(criteria={}, properties=["task_ids", "pretty_formula"])
):
for task_id in d["task_ids"]:
data[task_id] = d["pretty_formula"]
out = os.path... | StarcoderdataPython |
3582971 | <reponame>CHUV-DS/RDF-i2b2-converter<filename>src/scripts/merge_metavaluefields.py<gh_stars>0
import os
import sys
import pandas as pd
import pdb
import json
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath)
MIGRATIONS = {
"swissbioref:hasLabResultValue" : {
"concept":"sphn:L... | StarcoderdataPython |
3521847 | <filename>data_mgmt/generate_data.py<gh_stars>0
# -*- coding: utf-8 -*-
from fn_utils import make_fn_name, make_fn_desc
from fn_utils import make_row, flip_data_str_signs
from fn_utils import write_row
from ESD.data._utils import generate_func_string
from fn_data import C1_xdata, C1_ydata
from fn_data import C2_xdata... | StarcoderdataPython |
6505561 | from fabric.api import *
#
# Configurations
#
master_ip = '172.16.58.3'
slave_ip = '192.168.127.12'
env.user = 'ubuntu'
env.key_filename = '/home/keys/key.pem'
local_ip_list =[]
env.hosts = [master_ip, slave_ip]
@parallel
@with_settings(warn_only=True)
def git_checkout():
sudo('rm -Rf xuser')
run('git clone... | StarcoderdataPython |
1980703 | <filename>Python/Chittle_Ben FSE 2017-2018/Chittle, Ben - FSE.py
# Chittle, Ben - FSE.py
# 21 June 2018
# <NAME>
# This program contains 2 playable games, Tic Tac Toe and Guess the Number,
# which can be chosen, played, and replayed by the user(s).
# For pacing the program.
from time import sleep
# For generating ran... | StarcoderdataPython |
6620405 | from dynadb.models import DyndbFiles, DyndbFilesDynamics, DyndbModelComponents, DyndbCompound, DyndbDynamicsComponents,DyndbDynamics, DyndbModel, DyndbProtein,DyndbProteinSequence, DyndbModeledResidues
from view.assign_generic_numbers_from_DB import obtain_gen_numbering
from view.traj2flare_modified_wn import * #[!] N... | StarcoderdataPython |
11315990 | from flask import abort as abort
from flask import flash as flash
from flask import redirect as redirect
from flask import url_for as url_for
from .app import Djask as Djask
from .blueprints import APIBlueprint as APIBlueprint
from .blueprints import Blueprint as Blueprint
from .globals import current_app as current_a... | StarcoderdataPython |
3412103 | # file: redis_graph_common.py
# the purpose of this file is to implement common graph functions
import redis
import copy
class Redis_Graph_Common:
#tested
def __init__( self, redis, separator = chr(130), relationship_sep=chr(131), label_sep=chr(132), header_end=chr(133) ):
self.redis = redis
sel... | StarcoderdataPython |
342325 | <gh_stars>0
# Combine and Clean
import pandas as pd
temp_df = pd.read_csv('mergedARFINAL.csv')
#
temp_df = temp_df.drop_duplicates()
print(temp_df)
temp_df.to_csv('cleaned.csv')
| StarcoderdataPython |
3284193 | <filename>notifications/notifications.py
#!/usr/bin/env python
import argparse
import requests
import yaml
import os
try:
import json
except ImportError:
import simplejson as json
# Define the following environment variables:
# API_URL - The base url for the omp-data-api
# EMAIL_CONTENT_URL - Should be a u... | StarcoderdataPython |
230753 | import asyncio
import logging
import traceback
from abc import abstractmethod
from itertools import chain
from typing import Any, Dict, List, Set, Tuple
from stateflow import SilentError
from stateflow.common import Observable, T, ev, is_wrapper
from stateflow.decorators import DecoratedFunction
from stateflow.errors ... | StarcoderdataPython |
1639237 | <reponame>Enucatl/machine-learning-aging-brains
import apache_beam as beam
import agingbrains
import agingbrains.io
import agingbrains.read_gender
import agingbrains.voxel_fit
class CorrelationOptions(beam.utils.options.PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
parser.add_ar... | StarcoderdataPython |
5148781 | # -*- coding: utf-8 -*-
"""
hangulize.normalization
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2017 by <NAME>
:license: BSD, see LICENSE for more details.
"""
import unicodedata
__all__ = ['normalize_roman']
def normalize_roman(string, additional=None):
"""Removes diacritics from the string a... | StarcoderdataPython |
1969468 | import imp
import os
try:
import cpyext
except ImportError:
raise ImportError("No module named '_ctypes_test'")
try:
import _ctypes
_ctypes.PyObj_FromPtr = None
del _ctypes
except ImportError:
pass # obscure condition of _ctypes_test.py being imported by py.test
else:
import _pypy_testca... | StarcoderdataPython |
4823810 | <reponame>data-stories/chart-experiment<filename>demo/sample_batches.py
sample_batches ={
"0": {
"pie": [
["MG", "dd06", "sano", "sm0", "ftfa", "fs16", "llcl", "pano", "we00", "ro270","ad95"],
["CR", "dd06", "sa00", "sm1", "ftse", "fs18", "llcr", "pa05", "we05", "ro000", "ad07"],
["CM", ... | StarcoderdataPython |
3355559 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import re
class AtWikiStripper(object):
# Comment: `// comment`
COMMENT = re.compile(r'^//')
# Inline annotation: `&color(#999999){text}`, `&nicovideo(url)`
INLINE_ANN = re.compile(r'&[a... | StarcoderdataPython |
3232253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script used to analyze the ellipsometry data recorded on the Picometer Light ellipsometer available at the
Partneship for soft condensed matter at the Institut Laue-Langevin, Grenoble. The script uses the tmm package
developed by <NAME> (see https://pypi.org/project/t... | StarcoderdataPython |
5158293 | import unittest
from src.data import TBDatabase
class TestTBDatabase(unittest.TestCase):
def test_create_schema(self):
db = TBDatabase('test.db')
db.create_schema()
db.close()
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
6695819 | <filename>pyramid/MyShop/myshop/scripts/initializedb.py
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from ..models import (
DBSession,
#MyModel,
U... | StarcoderdataPython |
6409497 | import os
import csv
csvpath = os.path.join('Resources', 'budget_data.csv')
average_change = 0
with open(csvpath) as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
# Gets the header info
csv_header = next(csvreader)
# initialize variables using first row of data
first_row = next(csvre... | StarcoderdataPython |
1733909 | <filename>word2description/management/commands/set_games_as_finished.py
'''
Created on Mar 17, 2018
@author: alice
'''
from datetime import datetime, timedelta
from django.core.management.base import BaseCommand
from word2description.models import Game
def parse_time(time_str):
t = datetime.strptime(time_str,"... | StarcoderdataPython |
4838751 | from datetime import datetime
from pprint import pprint
from socket import gethostname
from threading import Thread
import nmap
from util import send_portscan
class PortscanThread(Thread):
def __init__(self, destination, scan_info):
super().__init__()
print(f"PortscanThread: initializing thread... | StarcoderdataPython |
6453034 | <filename>pose/networks/gcn.py
import torch
import torch.nn.functional as F
from torch import nn
from torchvision import models
from pose.utils import initialize_weights
from .config import res152_path
# many are borrowed from https://github.com/ycszen/pytorch-ss/blob/master/gcn.py
class _GlobalConvModule(nn.Module)... | StarcoderdataPython |
362982 | from typing import List
class Solution:
def longestSubarray(self, nums: List[int], limit: int) -> int:
self.numToIdx = {}
for i in range(len(nums)):
if nums[i] not in self.numToIdx:
self.numToIdx[ nums[i] ] = []
self.numToIdx[ nums[i] ].append(i)
sort... | StarcoderdataPython |
11246090 | <reponame>amtam0/u2netscan
import os
from skimage import io, transform
import torch
import torchvision
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
# import torch.optim as optim
import numpy ... | StarcoderdataPython |
1857355 | <filename>scripts/json2testlinkCsv.py
#!/usr/bin/python
# Goal : to extract dictionnary in an xlsx file from a list of requirements
from pyReq import *
import argparse
class ReqGetXlsx(pyReq):
""" class for export of requirements in csv file for testlink tool
the goal is to be able to enter req into testlink... | StarcoderdataPython |
1655136 | ################################################################################
# filename: switch_skill.py
# date: 07. Apr. 2021
# username: winkste
# name: <NAME>
# description: This module handles the input signal of a switch.
# In the first implementation it will only support polling of an
# ... | StarcoderdataPython |
3531879 | <reponame>aleph-oh/wikigame-solver
"""
This module contains constants for testing the database.
"""
from sqlalchemy import create_engine, event
from sqlalchemy.engine import Engine
from sqlalchemy.orm import sessionmaker
from ..utilities import set_sqlite_foreign_key_pragma
__all__ = ["TEST_DB_URL", "test_engine", "T... | StarcoderdataPython |
9703553 | # 翻译当前目录下所有srt文件,并在当前目录新建文件夹subtile_Translaed,保存所有翻译过的字幕文件,支持百度API和搜狗API
import http.client
import hashlib
import urllib
import random
import json
import time
import os
appid = '***************' # 填写你的appid
secretKey = '****************' # 填写你的密钥
# QPS = 1 #填写你的QPS
#打开当前目录下所有srt文件
srtFile = []
for i ... | StarcoderdataPython |
4902951 | dimensions = (200, 50)
print(dimensions[0])
print(dimensions[1])
for dimension in dimensions:
print(dimension)
print("Original dimensions:")
for dimension in dimensions:
print(dimension)
dimensions = (400, 1000)
print("\nModified dimensions:")
for dimension in dimensions:
print(dimension) | StarcoderdataPython |
12861467 | <reponame>wietsedv/gpt2-recycle<filename>src/preparation/2_prepare_0_tokens.py
from argparse import ArgumentParser
from pathlib import Path
import pickle
import os
from tqdm import tqdm
from tokenizers import Tokenizer
from tokenizers.processors import RobertaProcessing
from transformers import AutoTokenizer
def ini... | StarcoderdataPython |
9710240 | <reponame>QuillMcGee/CharacterAutoencoder
import time
import numpy as np
import pylab
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, Reshape, Flatten, UpSampling2D
from keras.models import Model
from matplotlib.widgets import Slider, Button
from helperfunctions import process, genvec
batch_size = 32
si... | StarcoderdataPython |
1743397 | <filename>experiments/perf_exp_2_das.py
from datetime import datetime
import socket
import os
import csv
import logging
import time
import sys
from experiment import Experiment
from system import DasSystem
import perf_exp_2
def main(order_on_write, read_heavy):
logging.basicConfig(format='%(asctime)s.%(msecs)03... | StarcoderdataPython |
8082269 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import json
class PchManufacturingRecord(Document):
pass
@frappe.whitelist()
def g... | StarcoderdataPython |
3388262 | #!/usr/bin/env python3
'''
Utilities for the video data loading pipeline.
Assumes that videos are already downloaded and preprocessed.
'''
from __future__ import division
import numpy as np
import csv,pickle,os
from glob import glob
from config import *
def _to_absolute_path(fn):
'''Convert timestamped... | StarcoderdataPython |
1930059 | from collections import deque
import sys
read = sys.stdin.readline
n, m, start = map(int, read().split())
v = [[] for _ in range(n + 1)]
for i in range(m):
v1, v2 = map(int, read().split())
v[v1].append(v2)
v[v2].append(v1)
for i in range(n + 1):
v[i].sort()
visited = [False] * (n+1)
res = []
stack = ... | StarcoderdataPython |
383579 | <reponame>HCDM/XRec
from rouge import Rouge
hypothesis = ["the #### transcript is a written version of each day 's cnn student news program use this transcript to help students with reading comprehension and vocabulary use the weekly newsquiz to test your knowledge of storie s yousaw on cnn student news" for i in rang... | StarcoderdataPython |
4903263 | # -*- coding: utf-8 -*-
from collections import OrderedDict
from gluon import current, URL
from gluon.storage import Storage
def config(settings):
"""
SHARE settings for Sri Lanka
@ToDo: Setting for single set of Sectors / Sector Leads Nationally
"""
T = current.T
# PrePopulate dat... | StarcoderdataPython |
390805 | import numpy as np
def rotation_about(axis,angle):
cth = np.cos(np.deg2rad(angle))
sth = np.sin(np.deg2rad(angle))
if axis=='x':
return np.array([[1,0,0],[0,cth,-sth],[0,sth,cth]])
elif axis=='y':
return np.array([[cth,0,-sth],[0,1,0],[sth,0,cth]])
elif axis=='z':
return np.a... | StarcoderdataPython |
11305299 | # import libraries
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.stattools import adfuller, kpss
from statsmodels.tools.sm_exceptions import InterpolationWarning
import warnings
# settings
warnings.filterwarnings('ignore', '.*ou... | StarcoderdataPython |
1793526 | from setuptools import setup, find_packages
setup(
name='pyexpert',
packages=find_packages(exclude=['tests']),
version='0.0.1',
description='A small prolog implementation for embedded expert systems',
long_description=open('README.md').read(),
keywords=['prolog'],
install_requires=['arpeggi... | StarcoderdataPython |
9605031 | '''
BINARY SEARCH TREE
* The left subtree of a node contains only nodes with keys lesser than the node’s key.
* The right subtree of a node contains only nodes with keys greater than the node’s key.
* The left and right subtree each must also be a binary search tree.
* There must be no duplicate nodes.
'''
class N... | StarcoderdataPython |
132994 | <gh_stars>1-10
import torch
from random import randint, gauss
def get_device():
return torch.device("cuda:{}".format(randint(0, torch.cuda.device_count() - 1)) if torch.cuda.is_available() else "cpu")
class OrnsteinUhlenbeckProcess(object):
# Ornstein–Uhlenbeck process
def __init__(self, dt=1, theta=.1... | StarcoderdataPython |
3528962 | <filename>polecat/model/defaults.py
from polecat.utils.proxy import Proxy
default_blueprint = Proxy('polecat.model.blueprint.Blueprint')
| StarcoderdataPython |
4862274 | <gh_stars>1-10
import requests
from decimal import Decimal
from datetime import datetime
from collections import defaultdict
import os
ETHERSCAN_KEY = os.environ["ETHERSCAN_KEY"]
def erc20_address_call(address):
"""API call to etherscan for an ethereum wallet
and returns the total positive count of remain... | StarcoderdataPython |
1955846 | <filename>5_18.py
"""Descrição:Programa que leia os valores indicados e imprima a quantidade de notas necessárias para pagar este valor
tabalhar com notas de 50, 20, 10, 5, 1. Neste caso incluir a nota de 100
Autor:<NAME>
Data:
Versão: 001
"""
# Declaração de variáveis
valor = int(0)
apagar = int(0)
cédulas = int(0)... | StarcoderdataPython |
6645358 | <reponame>zaygeee/MASTER
# coding=utf-8
import hmac
import hashlib
import base64
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from Crypto.Hash import MD5
priKey = '''-----<KEY>'''
class transfer:
def money_format(self, value):
value = "%.2f" % ... | StarcoderdataPython |
387019 | #!/usr/bin/env python
"""fuzza autogenerated."""
from __future__ import print_function
import socket
def str2b(data):
"""Unescape P2/P3 and convert to bytes if Python3."""
# Python2: Unescape control chars
try:
return data.decode('string_escape')
except AttributeError:
pass
except ... | StarcoderdataPython |
11200104 | <reponame>glpzzz/prognos
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
conditions.py
Copyright 2014 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
htt... | StarcoderdataPython |
6698738 | '''
write a sequence of argv[1] normally distributed random numbers with mean argv[2] and std.dev argv[3] into argv[4] (ASCII text file)
Example:
python create_init_distr.py 20 -16.44 0.3 fens.txt
'''
from math import *
import random
import sys #for getting command line args
noe = int(sys.argv[1]) #number of ensemble ... | StarcoderdataPython |
11250271 | <gh_stars>100-1000
__all__ = [
"CNNRegressor",
"FCNRegressor",
"InceptionTimeRegressor",
"LSTMRegressor",
"LSTMFCNRegressor",
"EncoderRegressor",
"CNTCRegressor",
"MCDCNNRegressor",
"MLPRegressor",
"ResNetRegressor",
"SimpleRNNRegressor",
"TLENETRegressor",
]
from sktime... | StarcoderdataPython |
261926 | <filename>conkit/io/tests/test_evfold.py
"""Testing facility for conkit.io.EVfold"""
__author__ = "<NAME>"
__date__ = "26 Oct 2016"
import os
import unittest
from conkit.core.contact import Contact
from conkit.core.contactfile import ContactFile
from conkit.core.contactmap import ContactMap
from conkit.core.sequence... | StarcoderdataPython |
9724701 | <filename>server/routes/dashboard.py
from pydantic import BaseModel
from fastapi import APIRouter
from fastapi.responses import JSONResponse
import jwt
from config import db, SECRET_KEY
router = APIRouter(prefix='/api')
account_collection = db.get_collection('accounts')
coin_collection = db.get_collection('coins')
c... | StarcoderdataPython |
305407 | <gh_stars>10-100
from sacrerouge.datasets.chaganty2018.subcommand import Chaganty2018Subcommand
| StarcoderdataPython |
205164 | import numpy as np
import os.path as osp
import random
import mmcv
import cv2
from .custom import CustomDataset
from .extra_aug import ExtraAugmentation
from .registry import DATASETS
from .transforms import (ImageTransform, BboxTransform, MaskTransform,
SegMapTransform, Numpy2Tensor)
from pyco... | StarcoderdataPython |
271224 | <filename>aliyun/api/rest/Rds20140815DescribeTasksRequest.py
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20140815DescribeTasksRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
self.EndTim... | StarcoderdataPython |
6458638 | <reponame>alexandersjoberg/sidekick
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from enum import Enum
from pathlib import Path
from typing import Dict, List
import requests
from requests.adapters import HTTPAdapter
from tqdm import tqdm
class Status(Enum):
PROCESSING = 1
SUCCE... | StarcoderdataPython |
1610911 | #!/usr/bin/python3
"""
Flask App that integrates with AirBnB static HTML Template
"""
from flask import Flask, render_template, request, url_for
import json
from models import storage
import requests
from uuid import uuid4
# flask setup
app = Flask(__name__)
app.url_map.strict_slashes = False
port = 8000
host = '0.0.... | StarcoderdataPython |
11264205 | # -*- coding: utf-8 -*-
import unittest
import json
import kraken
from pytest import raises
from pathlib import Path
from kraken.lib import xml
from kraken.lib.train import KrakenTrainer, RecognitionModel, SegmentationModel
from kraken.lib.exceptions import KrakenInputException
thisfile = Path(__file__).resolve().... | StarcoderdataPython |
3324171 | <gh_stars>0
from flask import Flask, Blueprint, render_template, abort, g, request
privacy_policy = Blueprint("privacy_policy", __name__)
@privacy_policy.route('/')
def loadTerms():
return render_template('/privacy_policy/index.html')
| StarcoderdataPython |
4829526 | # This script will implement the INSERTION-SORT
# from the Algorithms (MIT) book
#####################################################|
#IMPORTS |
#____________________________________________________|
from random import shuffle
#####################################... | StarcoderdataPython |
8055460 | <reponame>zuhorski/EPL_Project
#
# This assumes that you have MSAccess and DAO installed.
# You need to run makepy.py over "msaccess.tlb" and
# "dao3032.dll", and ensure the generated files are on the
# path.
# You can run this with no args, and a test database will be generated.
# You can optionally pass a dbname ... | StarcoderdataPython |
4837268 | # !/usr/bin/env python
# coding=UTF-8
"""
@Author: <NAME>
@LastEditors: <NAME>
@Description:
@Date: 2021-08-31
@LastEditTime: 2021-11-11
文本文件日志
"""
import time
import os
import logging
from typing import NoReturn, Iterable, List, Optional, Any
import terminaltables
from .base import AttackLogger
from ..misc import ... | StarcoderdataPython |
8189678 | from typing import Generic, TypeVar, Iterable
import asyncio
import logging
from aioreactive.core import AsyncDisposable, AsyncCompositeDisposable
from aioreactive.core import AsyncObserver, AsyncObservable
from aioreactive.core import AsyncSingleStream, chain
log = logging.getLogger(__name__)
T = TypeVar('T')
clas... | StarcoderdataPython |
8160596 | <filename>helpers/make_2D_zarr_pathology.py<gh_stars>0
import numpy as np
import zarr
from openslide import OpenSlide
slide = OpenSlide('data/camelyon16/tumor_001.tif')
file_name = 'data/camelyon16/tumor_001.zarr'
root = zarr.open_group(file_name, mode='a')
for i in range(0, 3):
print(i, 10)
shape = (slide.... | StarcoderdataPython |
8122428 | from PyPDF2 import PdfFileMerger
import os
def merger(pdfs):
print(pdfs)
merger = PdfFileMerger(False)
for pdf in pdfs:
current_file = ".\\samples\\" + pdf
merger.append(current_file)
merger.write("result.pdf")
merger.close()
if __name__ == '__main__':
pdfs = os.listdir('... | StarcoderdataPython |
5016671 | from flask import json
from isaac.models import Record
from isaac import app
# ==============================
# API DATATABLES + GLOBAL API(no-cors)
# ==============================
# этот роут использует таблица DataTables на главной странице
@app.route("/api/cat_mother")
def cat_mother():
data = {
"cat_m... | StarcoderdataPython |
9685359 | <gh_stars>10-100
import unittest
import random
import threading
import System
from System.IO import Directory
from System.IO import Path
from System.Collections.Generic import Dictionary
from System.Collections.Generic import SortedDictionary
from System.Collections.Generic import SortedList
import clr
... | StarcoderdataPython |
21152 | <reponame>darshikaf/toy-robot-simulator
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import math
class Point:
def __init__(self, x: int = 0, y: int = 0):
self.x = x
self.y = y
def __eq__(self, other: object) -> bool:
if isinstance(other, Point):
... | StarcoderdataPython |
5049574 | <filename>mapper.py
import shapefile
from spatialindex import SBN, Bin, Feature
from math import floor, ceil
def mapshapefile(sf):
# map features in a shapefile to index space
shapes = sf.shapes()
features = []
for index, shape in enumerate(shapes):
ft = mapfeature(index,shape,sf)
featu... | StarcoderdataPython |
1831284 | #!/usr/local/bin/python
import audio
audio.playNext()
audio.playNext()
audio.playNext()
audio.playNext()
| StarcoderdataPython |
3435636 | <reponame>IngoKl/quotapi
from flask import Flask, jsonify, abort, request
from termcolor import colored
import logging
import datetime
import sqlite3
import json
import random
# Quotapi v.1.1; 09.06.2016, MIT License (<NAME> 2016)
# Disable Console Output
log = logging.getLogger('werkzeug')
log.setLevel(l... | StarcoderdataPython |
5064430 | <filename>vnpy/analyze/data/data_prepare.py
from datetime import datetime, timedelta
from jqdatasdk import *
import vnpy.trader.constant as const
from vnpy.app.cta_strategy.base import (
INTERVAL_DELTA_MAP
)
from vnpy.trader.database import database_manager
from vnpy.trader.object import BarData, FinanceData
import... | StarcoderdataPython |
12823737 | <gh_stars>0
#
# -------------------------------------------------------------------------
# Copyright (c) 2019 AT&T Intellectual Property
#
# 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 ... | StarcoderdataPython |
1639395 | <gh_stars>1-10
"""
SNPmatch
"""
import numpy as np
import pandas as pd
import scipy as sp
from scipy import stats
import numpy.ma
import logging
import sys
import os
from . import parsers
from . import snp_genotype
import json
log = logging.getLogger(__name__)
lr_thres = 3.841
snp_thres = 4000
prob_thres = 0.98
def... | StarcoderdataPython |
3258897 | <reponame>UNCDarkside/DarksiteAPI<filename>darksite/account/migrations/0001_initial.py
# Generated by Django 2.1.4 on 2018-12-16 05:56
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [("auth", "0009_alter_user_last_name_max_length")]... | StarcoderdataPython |
9690136 | # -*- coding: utf-8 -*-
#
# Copyright 2015-2022 BigML
#
# 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 ... | StarcoderdataPython |
76202 | #!/usr/bin/python
from __future__ import division, print_function
# require python 3.5 for aiohttp
import sys
if sys.hexversion < 0x03050000:
sys.exit("Python 3.5 or newer is required to run this program.")
import numpy as np
import json
from io import BytesIO
import asyncio
from aiohttp import web, WSMsgType
fro... | StarcoderdataPython |
9660995 | import os, logging
import numpy as np
import matplotlib.pyplot as plt
from scipy import interp
from textwrap import wrap
from sklearn.metrics import precision_recall_curve, average_precision_score, auc
logger = logging.getLogger('eyegaze')
class VisdomLinePlotter(object):
"""Plots to Visdom"""
def __init__(s... | StarcoderdataPython |
1845136 | from app import create_app
from config.app_config import LocalConfig
if __name__ == '__main__':
app = create_app(LocalConfig)
app.run(**app.config['RUN_SETTINGS']) | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.