id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4837228 | from utilityFunctions import HandleError, printMessage
import sys
import numpy
import math
import operator
import os
import time
class Column(object):
def __init__(self, list):
self.l = list
def max(self):
return max(self.l)
def at(self, i):
return self.l[i]
def a... | StarcoderdataPython |
1637231 | <reponame>MrRook/CPP
# file comparator
import sys
ff=open(sys.argv[1],"r")
fs=open(sys.argv[2],"r")
k=ff.readlines()
j=fs.readlines()
ff.close()
fs.close()
if(len(k)!=len(j)):
print("WA")
sys.exit(1)
for i in range(len(k)):
if len(k[i].split()) != len(j[i].split()) or cmp(k[i].split(),j[i].split())!=0:
print("WA")... | StarcoderdataPython |
3265725 | <filename>code/groove2groove/eval/style_profiles.py<gh_stars>10-100
#!/usr/bin/env python3
import argparse
import collections
import gzip
import json
import logging
import random
import sys
import coloredlogs
import lmdb
import numpy as np
from confugue import Configuration, configurable
from museflow import note_sequ... | StarcoderdataPython |
3359146 | <gh_stars>10-100
import threading as th
import logging as lg
lg.basicConfig(level=lg.DEBUG,format="%(threadName)10s %(message)-10s")
lg.debug('hello')
class keshav(th.Thread):
def run(self):
lg.debug('keshav')
t=keshav()
t.start()
t.join()
'''
output:
MainThread hello
Thread-17 keshav
'''
| StarcoderdataPython |
134221 | <reponame>GabrielAmare/Darts
from .BaseFile import BaseFile
class TextFile(BaseFile):
extension = ".txt"
@classmethod
def save(cls, fp: str, content: str) -> None:
with cls._open_w(fp) as file:
file.write(content)
@classmethod
def load(cls, fp: str) -> str:
with cls._... | StarcoderdataPython |
4822795 | <filename>day08/partone.py
import os
import sys
import re
class Bootloader():
accumulator = 0
bootcode = []
inp = 0
def __init__(self, bootcode):
for bc in bootcode:
bc = bc.strip()
cmd, param = bc.split(" ")
self.bootcode.append({ "cmd": cmd, "param": param... | StarcoderdataPython |
1656151 | <gh_stars>0
import sys
import os
from pymongo import MongoClient
# add internal packages
sys.path.append(os.path.join(os.path.dirname(sys.path[0]), 'config'))
from mongo_config import MONGO_SERVER_CONFIG
def create_or_use_database_and_collection(db_connection, db_name, collection_name):
db = db_connection[db_name]
... | StarcoderdataPython |
1780301 | import json
# from common.connectDB import SqL
import logging
# sql = SqL()
log = logging.getLogger('log') # 初始化log
def get_json(path, field=''):
"""
获取json文件中的值,data.json和res.json可共用
:param path:
:param field:
:return:
"""
with open(path, 'r', encoding='utf-8') as f:
json_data =... | StarcoderdataPython |
124179 | <reponame>arcanefoam/wiser-home-card
"""The Wiser Home Component."""
| StarcoderdataPython |
3278941 | <reponame>PetePrattis/traveling-salesman-problem-with-genetic-algorithms
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import numpy
import random
import itertools
#this is code for random number of cities with random distances
'''
#number of cities
citycount = random.randrange(5, 10)
#calculating numbe... | StarcoderdataPython |
1247 | # -*- coding: utf-8 -*-
'''
Tests for the file state
'''
# Import python libs
from __future__ import absolute_import
import errno
import os
import textwrap
import tempfile
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.paths import TMP_STATE_TREE
from tests.support.mixins impor... | StarcoderdataPython |
36489 | <filename>script/generate_default_repositories.py
import requests
import json
import os
from github import Github
BASE = """---
id: default_repositories
title: Default repositories
description: "Default repositories in HACS"
---
<!-- The content of this file is autogenerated during build with script/generate_default_r... | StarcoderdataPython |
3277608 | <reponame>jhlegarreta/dwi_ml
import json
import logging
import pathlib
import re
from typing import Dict, IO, List, Union
import nibabel as nib
import numpy as np
from dipy.core.gradients import (gradient_table)
from dipy.io.stateful_tractogram import Space, StatefulTractogram
from dipy.io.streamline import load_trac... | StarcoderdataPython |
3263454 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import cv2
from tqdm import tqdm
import numpy as np
# In[2]:
class Encode:
# Decimal to 8-bit Binary conversion
def dectobin(num):
temp= bin(num).replace('0b','')
while len(temp)<8:
temp= '0' + temp
ret... | StarcoderdataPython |
3244637 | <filename>Ex_Files_Python_Standard_Library_EssT/Exercise Files/Chapter 1/01_02/basicstr_start.py
# use predefined string constants
import string
# TODO: predefined string constants can be used in common scenarios
print(string.ascii_letters)
print(string.digits)
print(string.hexdigits)
print(string.punctuation)
print... | StarcoderdataPython |
3207872 |
def dataEvaluation_func(Xscores,Ylabels):
from sklearn.model_selection import LeaveOneOut,cross_validate
from sklearn import model_selection,svm
from sklearn.metrics import classification_report, roc_curve, precision_recall_curve, roc_auc_score, auc, \
make_scorer, recall_score, accuracy_score, p... | StarcoderdataPython |
1620201 | r"""
Core module providing cost-to-go function implementation :class:`CostToGo`.
"""
from __future__ import annotations
import warnings
import torch
from ml_adp.nn import ModuleList, _evaluating
import numpy as np
import itertools as it
import matplotlib.pyplot as plt
from contextlib import ExitStack
from typing impor... | StarcoderdataPython |
195155 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pandas_datareader as web
import datetime as dt # This is a core python module.
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.models import Sequential # A Sequential model contains a "line... | StarcoderdataPython |
105545 | <reponame>console-beaver/dedo
"""
Common utilities for training.
Note: this code is for research i.e. quick experimentation; it has minimal
comments for now, but if we see further interest from the community -- we will
add further comments, unify the style, improve efficiency and add unittests.
@contactrika
"""
fro... | StarcoderdataPython |
3334410 | <gh_stars>100-1000
import importlib
from feast.errors import (
FeastClassImportError,
FeastInvalidBaseClass,
FeastModuleImportError,
)
def import_class(module_name: str, class_name: str, class_type: str = None):
"""
Dynamically loads and returns a class from a module.
Args:
module_na... | StarcoderdataPython |
3330368 | <reponame>fahrer16/rachio-nodeserver
#!/usr/bin/python
""" Rachio Node Server for Polyglot by <NAME> (<EMAIL>).
Based on LIFX Node Server for Polyglot by Einstein.42(<NAME>) (https://github.com/Einstein42/lifx-nodeserver)
Uses the rachiopy Python client written by rfverbruggen(<NAME>) (https://github.com/... | StarcoderdataPython |
1631756 | <reponame>aresPanos/DMGP_regression<filename>src/main_simulated_data.py
#!/usr/bin/python3
# Copyright 2020 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/... | StarcoderdataPython |
45034 | import argparse
import os
import random
import pandas as pd
class DatasetSplitter:
""" Class that can be used to create a reproducible random-split of a dataset into train/validation/test sets """
def split_annotations_into_training_validation_and_test_set(self, dataset_directory: str,
... | StarcoderdataPython |
1774373 | <filename>tests/functional/client/test_cli_client.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Perform a functional test for client helper functions."""
import os
import pytest
import orion.core.cli
from orion.core.worker.consumer import Consumer
def test_interrupt(storage, monkeypatch, capsys):
"""Test ... | StarcoderdataPython |
32748 | # -*- coding: utf-8 -*-
"""
Created on 2021-03-11 18:53:58
---------
@summary:
抓糗事百科的案例
---------
@author: Administrator
"""
import feapder
class Spider(feapder.AirSpider):
def start_requests(self):
for page_num in range(1, 2):
url = "https://www.qiushibaike.com/8hr/page/{}/".format(page_... | StarcoderdataPython |
3318657 | <reponame>LaurenceYang/learn-python
class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score
def get_name(self):
return self.__name
def get_score(self):
return self.__score
def set_score(self, score):
if 0 <= score <= 100:... | StarcoderdataPython |
1738347 | <gh_stars>1-10
# Copyright (c) 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | StarcoderdataPython |
1647796 | <gh_stars>1-10
# Copyright (c) 2020-2021 <NAME>
# Licensed under the MIT License (see LICENSE for details)
from copy import copy
class Idx(object):
"""
Index class
Attributes:
index (int): Integer labelling an index as unique
space (str): Name of the index space
fermion (bool): In... | StarcoderdataPython |
1688753 | <reponame>ajuvercr/idasen-controller
#!python3
import os
import sys
import shutil
import struct
import argparse
import yaml
import asyncio
from bleak import BleakClient, BleakError, BleakScanner
import pickle
import json
import functools
from appdirs import user_config_dir
IS_LINUX = sys.platform == "linux" or sys.pla... | StarcoderdataPython |
1640344 | <reponame>GSH-LAN/byceps
"""
byceps.services.user.screen_name_validator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Validate screen names regarding their contained characters
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from itertools import chain
from string import ascii_le... | StarcoderdataPython |
3302623 | <reponame>johnydough/Discord-Bot<filename>cogs/jokes.py
import discord
from discord.ext import commands
import pyjokes
class Jokes(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(brief="tells a joke", description="tells a joke")
async def joke(self, ctx):
awa... | StarcoderdataPython |
3387756 | from pymol import *
cmd.load("Psi_a_126_126-A.cube")
cmd.load("Psi_b_126_126-A.cube")
cmd.load("Psi_a_127_127-A.cube")
cmd.load("Psi_b_127_127-A.cube")
cmd.load("target.mol")
cmd.isomesh("HOMO_A", "Psi_a_126_126-A", -0.02)
cmd.isomesh("HOMO_B", "Psi_b_126_126-A", 0.02)
cmd.isomesh("LUMO_A", "Psi_a_127_127-A", 0.02)
cmd... | StarcoderdataPython |
69582 | <gh_stars>1-10
from django.db import models
class TokenTypes(models.TextChoices):
BEP_20 = "BEP-20"
ETH_ERC_20 = "ERC-20"
ETH_ERC_223 = "ERC-223"
ETH_ERC_721 = "ERC-721"
ETH_ERC_777 = "ERC-777"
ETH_ERC_820 = "ERC-820"
ETH_ERC_1155 = "ERC-1155"
SOL_SPL = "SPL"
EOS_EOSIO = "EOSIO"
... | StarcoderdataPython |
1643651 | #!/usr/bin/env python3
########################
#Author: <NAME>
#Copyright 2016
######################
import argparse
import isce
import isceobj
import os
import gdal
import xml.etree.ElementTree as ET
def createParser():
'''
Create command line parser.
'''
parser = argparse.ArgumentParser( descripti... | StarcoderdataPython |
52122 | """
This module defines functions that are called on a django signal such as post_migrate.
"""
from serverside import utils
def create_permissions_and_grant_privileges(*args, **kwargs):
"""
Creates database permissions to assign to a user.
Creates django permissions that reflect what a corresponding dat... | StarcoderdataPython |
4816229 | from setuptools import setup
setup(name='jupyter_quon_kernel',
version='1.2.1',
description='Minimalistic quon kernel for Jupyter',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
classifiers=[
'License :: OSI Approved :: MIT License',
],
url='https://g... | StarcoderdataPython |
1670668 | import os
import pygame
import base
import bird
import pipe
import neat
pygame.init()
WIDTH, HEIGHT = 288, 512
BG_IMG = pygame.image.load('assets/bg.png')
FPS = 60
WIN = pygame.display.set_mode((WIDTH, HEIGHT), pygame.HWSURFACE | pygame.DOUBLEBUF)
VELOCITY = -2
THRESHOLDS = {
'base': -337,
'pipe': 72
}
FONT = ... | StarcoderdataPython |
184500 | """Leetcode 252. Meeting Rooms (Premium)
Easy
URL: https://leetcode.com/problems/meeting-rooms
Given an array of meeting time intervals consisting of start and end times
[[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings.
Example 1:
Input: [[0,30],[5,10],[15,20]]
Output: false
Example ... | StarcoderdataPython |
3396324 | <filename>LeetCode/Python/same_tree.py
#!/usr/bin/env python
#coding: utf-8
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param p, a tree node
# @param q, a tree node
# @return a bo... | StarcoderdataPython |
187912 | <filename>release/stubs.min/Wms/RemotingObjects/Outbound/__init__.py
# encoding: utf-8
# module Wms.RemotingObjects.Outbound calls itself Outbound
# from Wms.RemotingObjects,Version=1.23.1.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no important
from System.Collections.Generic import *
... | StarcoderdataPython |
98479 | <gh_stars>1-10
from typing import Any, List
import hydra
import numpy as np
import pytorch_lightning as pl
import wandb
from omegaconf import DictConfig
from pytorch_lightning import loggers as pl_loggers
from seg_lapa import metrics
from seg_lapa.callbacks.log_media import LogMediaQueue, Mode
from seg_lapa.config_pa... | StarcoderdataPython |
3237816 | import re
import gensim
'''
longest = 0
l = None
with open('../TeamLTSM/reviews_Office_.txt') as file:
for line in file:
cur = len(re.sub(r'\W+', ' ', line).split(' '))
if cur > longest:
longest = cur
#l = line
print(longest)
#print(l)
'''
'''
def TagDocument():
... | StarcoderdataPython |
3222829 | <gh_stars>10-100
from IPython.display import Image
import numpy as np
from scipy.stats import pearsonr
def answer_one(your_answer):
'''
your answer should be a letter a to e
'''
if your_answer == "rmse":
print("That's right! RMSE is used to evaluate how well a regression prediction is performi... | StarcoderdataPython |
1607794 | from test.integration.base import DBTIntegrationTest, use_profile
import os
import re
import yaml
import pytest
class TestDebug(DBTIntegrationTest):
@property
def schema(self):
return 'dbt_debug_049'
@staticmethod
def dir(value):
return os.path.normpath(value)
@property
def... | StarcoderdataPython |
1760253 | <reponame>BarracudaPff/code-golf-data-pythpn
"""Setup script for delf."""
setup(name="delf", version="0.1", include_package_data=True, packages=find_packages(), description="DELF (DEep Local Features)") | StarcoderdataPython |
144849 | <filename>openks/abstract/mtg.py
# Copyright (c) 2021 OpenKS Authors, DCD Research Lab, Zhejiang University.
# All Rights Reserved.
"""
Abstract dataset format MTG for Multi-type Knowledge Graph
"""
from typing import List, Dict, Any
from .mmd import MMD
class MTG(MMD):
"""
A structure for standard graph data form... | StarcoderdataPython |
3308911 | def save_to_file(content, filename):
with open(filename, 'w') as file:
file.write(content)
def read_file(filename):
with open(filename, 'r') as file:
return file.read() | StarcoderdataPython |
188818 | import argparse
import configparser
import json
import sys
import torch
from retinanet import model
assert torch.__version__.split('.')[0] == '1'
print('CUDA available: {}'.format(torch.cuda.is_available()))
def main(args=None):
parser = argparse.ArgumentParser(description='Simple training script for training... | StarcoderdataPython |
3367364 | <gh_stars>0
import numpy as np
import torch
def data_loader(input_path, dataset_name):
train_dataset = np.loadtxt(f'{input_path}/{dataset_name}/{dataset_name}_TRAIN.txt')
test_dataset = np.loadtxt(f'{input_path}/{dataset_name}/{dataset_name}_TEST.txt')
# train dataset clean up
x_train, y_train = train... | StarcoderdataPython |
13482 | #!/usr/bin/env python
"""
Test code for the BBox Object
"""
import numpy as np
import pytest
from geometry_utils.bound_box import (BBox,
asBBox,
NullBBox,
InfBBox,
f... | StarcoderdataPython |
3279559 | <filename>PyCharm/TCP_streaming_server/dependencies/queue_ops.py
from multiprocessing import Queue
from queue import Empty
def lossy_enqueue(q: Queue, data):
r = None
if q is not None:
if q.full():
try:
r = q.get_nowait()
except Empty:
pass
... | StarcoderdataPython |
171910 | import json
import logging
import traceback
from urllib.request import urlopen, Request
from uniswap.uniswap import UniswapV2Client
import os
from web3 import Web3
import time
from datetime import datetime
import math
logger = logging.getLogger(__name__)
ACC = 'xxx'
PRIVATE_KEY = 'xxx'
API = 'xxx'
NETWORK = 'https:/... | StarcoderdataPython |
29056 | import os
def check_path(path):
if not path or not path.strip() or os.path.exists(path):
return
os.makedirs(path)
pass | StarcoderdataPython |
18330 | <filename>retroroot.py
#!/usr/bin/env python3
"""Use this file to setup a build environment."""
import os
import argparse
from support.linux.log import Log
from support.docker_wrapper.retroroot import RetrorootDocker
CWD = os.getcwd()
def parse_args(args):
"""Parse arguments.
:return: The argument object.
... | StarcoderdataPython |
197128 | import torch
import warnings
import transformers
import sklearn.preprocessing
class NERDADataSetReader():
"""Generic NERDA DataSetReader"""
def __init__(self,
sentences: list,
tags: list,
transformer_tokenizer: transformers.PreTrainedTokenizer,
... | StarcoderdataPython |
3300174 | <reponame>nanojob/python-slimta<gh_stars>100-1000
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... | StarcoderdataPython |
3395649 | <filename>python/mod-divmod.py
a,b=int(input()),int(input())
print(a//b,a%b,divmod(a,b),sep='\n')
| StarcoderdataPython |
113842 | <reponame>KorynLA/dwellinglyapi
from flask import Flask
from flask_restful import Api
from flask_jwt_extended import JWTManager
from models.user import UserModel
from resources.user import UserRegister, User, UserLogin
from resources.property import Properties, Property
from db import db
app = Flask(__name__)
#confi... | StarcoderdataPython |
3213849 | """
Definition for a undirected graph node
class UndirectedGraphNode:
def __init__(self, x):
self.label = x
self.neighbors = []
"""
class Solution:
"""
@param: nodes: a array of Undirected graph node
@return: a connected set of a Undirected graph
"""
def connectedSet(self, node... | StarcoderdataPython |
87073 | <filename>setup.py
# Copyright 2014 Deezer (http://www.deezer.com)
#
# 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 ap... | StarcoderdataPython |
3275492 | <reponame>ermongroup/pirank<gh_stars>10-100
from sacred import Experiment
from sacred.stflow import LogFileWriter
from sacred.observers import SqlObserver, MongoObserver
# Uncomment if using GPU
# import setGPU
from tfdeterminism import patch
patch()
import random
import numpy as np
import tensorflow as tf
import tenso... | StarcoderdataPython |
3235605 | import asyncio
import discord
from discord.ext import bridge
intents = discord.Intents.default()
intents.message_content = True
bot = bridge.Bot(command_prefix="!", intents=intents)
@bot.bridge_command()
async def ping(ctx):
await ctx.respond("Pong!")
@bot.bridge_command()
@discord.option(name="value", choi... | StarcoderdataPython |
117491 | <reponame>pingrunhuang/CodeChallenge
'''
Matrix:
Count the number of islands in a matrix
'''
class Solution:
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
def getIsland(i,j):
if 0<=i<len(grid) and 0<=j<len(grid[0]) and grid[i][j]=='1... | StarcoderdataPython |
59291 | <filename>solutions/practice/if_twoAway.py
# Create a program such that when given a non-negative number input, output whether or not if the number is 2 away from a multiple of 10.
# input
num = int(input('Enter a positive number: '))
# processing & output
if (num + 2) % 10 == 0:
print(num, 'is 2 away from a mult... | StarcoderdataPython |
3290280 | <filename>ck101/models.py
from django.db import models
# Create your models here.
class Post(models.Model):
# 爬取网页的最外部和楼主的发文内容
# url = models.URLField(max_length=512) # 网址
entrance_id = models.IntegerField(default=0)
category = models.CharField(max_length=255) # 发文的类别
title = models.TextField() ... | StarcoderdataPython |
3371527 | from django.contrib import admin
from .models import (
StripeAcceptedCountry, Connect, City, Currency, ExternalAccount
)
class ConnectAdmin(admin.ModelAdmin):
list_display = [
'pk', 'user', 'connect_id', 'first_name', 'last_name', 'email', 'phone',
'country', 'city', 'business_type', 'is_activ... | StarcoderdataPython |
3387803 | from neo.UIntBase import UIntBase
class UInt160(UIntBase):
def __init__(self, data=None):
super(UInt160, self).__init__(num_bytes=20, data=data)
| StarcoderdataPython |
1784676 | #!/usr/bin/env python
import puka
client = puka.Client("amqp://localhost/")
promise = client.connect()
client.wait(promise)
promise = client.queue_declare(queue='hello')
client.wait(promise)
print ' [*] Waiting for messages. To exit press CTRL+C'
consume_promise = client.basic_consume(queue='hello', no_ack=True)
... | StarcoderdataPython |
3279565 | # example:
# --------
# python3 get_explanations_for_human_annotation.py \
# --corpus sst \
# --text-path "../data/human-corpus/sst.txt" \
# --load-model-path "../data/saved-models/test-sst-softmax/" \
# --load-explainer-path "../data/saved-models/communicate-sst-softmax/" \
# --output-path "../data/explanations/sst_... | StarcoderdataPython |
1665283 | <reponame>Vl-tb/Quad-Drone
import time
from connect import connectMyCopter
from photo_shot import photo
from take_off import arm_and_takeoff
from land import land
def start_mission(high):
vehicle = connectMyCopter()
print("About to takeoff..")
arm_and_takeoff(vehicle, high)
while vehicle.attitude <= ... | StarcoderdataPython |
181123 | <reponame>btc-ag/revengtools<gh_stars>1-10
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from base.basic_config_if import BasicConfig
from base.dependency.dependency_base import (BaseSuffixModuleGrouper,
BaseDependencyFilterConfiguration)
from base.dependency.dependency_default import DefaultDependencyFilter
fro... | StarcoderdataPython |
69269 | import asyncio
import random
import arrow
import discord
from discord.ext import commands, tasks
from libraries import emoji_literals
from modules import emojis, log, queries, util
logger = log.get_logger(__name__)
command_logger = log.get_command_logger()
class Events(commands.Cog):
"""Event handlers for vari... | StarcoderdataPython |
123987 | import pytest
from polyswarmartifact import ArtifactType
from polyswarmartifact.exceptions import DecodeError
def test_file_artifact_type_from_lowercase_string():
# arrange
# act
artifact_type = ArtifactType.from_string('file')
# assert
assert artifact_type == ArtifactType.FILE
def test_file_art... | StarcoderdataPython |
1790163 | <gh_stars>10-100
import logging
import numpy as np
import rasterio
from skimage import exposure
from tqdm import tqdm
from tqdm.contrib.logging import logging_redirect_tqdm
from satproc.utils import sliding_windows
__author__ = "<NAME>"
__copyright__ = "Dymaxion Labs"
__license__ = "Apache-2.0"
_logger = logging.ge... | StarcoderdataPython |
3341760 | <reponame>casperg92/MaSIF_colab<gh_stars>1-10
import Bio
from Bio.PDB import *
from Bio.SeqUtils import IUPACData
import sys
import importlib
import os
import numpy as np
from subprocess import Popen, PIPE
from pathlib import Path
from convert_pdb2npy import load_structure_np
import argparse
parser = argparse.Argumen... | StarcoderdataPython |
3217972 | <gh_stars>0
import sys
from config import servers as serv
from config import users as user
from config import passwords as <PASSWORD>
from config import log_path as log_path
from fabric import Connection
command = "tail -n 50 -f -s 5 "
def vivere_app():
con = Connection(host=serv.machine4,
... | StarcoderdataPython |
3253110 | from osgeo import gdal
import numpy as np
import osr
def write_tif_to_disk(dir, raster, geotif):
# Picking up values reference values needed to export to geotif
projection = osr.SpatialReference()
projection.ImportFromWkt(geotif.GetProjectionRef())
# Grab the geotransformation values
geo_transfor... | StarcoderdataPython |
1681785 | from abc import abstractmethod
DEPENDENTS_VALUE = 189.59
class Tax(object):
@abstractmethod
def calculate(self, paybill):
pass
class INSS(Tax):
def calculate(self, paybill):
salary = paybill.salary
descount = 0
if salary <= 1751.81:
descount = salary * 0.08
... | StarcoderdataPython |
1626239 | <filename>misc/seqan_instrumentation/py2exe/dist/classes/requests/packages/oreos/structures.py
# -*- coding: utf-8 -*-
"""
oreos.structures
~~~~~~~~~~~~~~~~
The plastic blue packaging.
This is mostly directly stolen from mitsuhiko/werkzeug.
"""
__all__ = ('MultiDict',)
class _Missing(object):
def __repr__(sel... | StarcoderdataPython |
102388 | from functools import wraps
from logging import getLogger
from typing import Dict, Union
import requests
from ethereum.utils import (check_checksum, checksum_encode, ecrecover_to_pub,
privtoaddr, sha3)
from hexbytes import HexBytes
from web3 import HTTPProvider, Web3
from web3.middleware im... | StarcoderdataPython |
152072 | from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
# Uses Mocking to test the database.
class CommandsTestCase(TestCase):
def test_wait_for_db_ready(self):
# Test to wait for the db to become avail... | StarcoderdataPython |
1689062 | <filename>paper/code/example4.py
if __name__=="__main__":
from collections import OrderedDict
hl = HyperloopPod()
#design variables
hl.Mach_bypass = .95
hl.Mach_pod_max = .7
hl.Mach_c1_in = .65
hl.c1_PR_des = 13
#initial guesses
hl.compress.W_in = .46
hl.flow_limit.radius_tube ... | StarcoderdataPython |
4819703 | # -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we a... | StarcoderdataPython |
1681167 | <reponame>OttoWinter/esphomeyaml
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import output
from esphome.const import CONF_CHANNEL, CONF_ID, CONF_GAIN
from . import MCP4728Component, mcp4728_ns
DEPENDENCIES = ["mcp4728"]
MCP4728Channel = mcp4728_ns.class_("MCP4728Channel... | StarcoderdataPython |
1748344 | <reponame>aadishgoel2013/Puzzles-with-Python-
for i in range(1,101):
print(i**6)
| StarcoderdataPython |
3209213 | <filename>GMRF/GLASSOEstimator.py
from scipy import linalg
import numpy as np
class GLASSOEstimator:
def __init__(self, lambd, max_iters=10, alpha=1, tikhonov=0.0):
self.alpha = alpha
self.tikhonov = tikhonov
self.lambd = lambd
self.max_iters = max_iters
def fit(self, S, Q=No... | StarcoderdataPython |
92576 | #!/usr/bin/python
'''
(C) Copyright 2018-2019 Intel Corporation.
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 applic... | StarcoderdataPython |
166247 | # -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2016, 2017 <NAME> <<EMAIL>>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either... | StarcoderdataPython |
3312176 | <reponame>DrM0h4MM4d/api-uploader<filename>Server/upload/models.py<gh_stars>0
from django.db import models
from django.conf import settings
from .validators import upload_file_path, upload_file_validator
User = settings.AUTH_USER_MODEL
# Create your models here.
class Uploader(models.Model):
title = models.CharFi... | StarcoderdataPython |
1767478 | <reponame>screaze/discord-token-checker
from requests import get, post
from random import randint
alaala = 0
alaala2 = 0
alaala3 = 0
logo = """
[SYSTEM] Discord Token Checker by Screaze
"""
def checker1(token):
response = get('https://discord.com/api/v6/auth/login', headers={"Authorization": token})
return True... | StarcoderdataPython |
1662701 | #! /usr/bin/python
import sys, getopt, os, json, traceback, ssl
import urllib2
from urllib2 import HTTPError
from urllib2 import URLError
import platform # For getting the operating system name
import subprocess # For executing a shell command
metadataFile='metadata.json'
def using():
filename =... | StarcoderdataPython |
171861 | <reponame>davidbrough1/cse_6140_project<filename>test.py<gh_stars>0
#This file is used to test the code.
import subprocess
def test(filename, method, cutoff, seed):
commandline = ['python', 'TSP.py', '--inst', filename, '--alg',
method, '--time', str(cutoff), '--seed', str(seed)]
subprocess... | StarcoderdataPython |
3297420 | <filename>chromato/parse.py
import math
from chromato import convert, validation, utils
from chromato.spaces import Color, CMYK, HEX, HSL, HSV, RGB
def _is_possibly_hex(arg):
return isinstance(arg, str) and len(arg.strip("# ")) > 0
def _parse_rgb_values(*args) -> tuple:
return tuple(map(math.ceil, _parse_fl... | StarcoderdataPython |
3328379 | from random import choice
import logging
from flask import render_template
from fbvoting.db.chart import chart_iterator
from fbvoting.db.categories import categories
from fbvoting.mylogging import report
logger = logging.getLogger(__name__)
def build_error(error_code):
data = dict()
try:
c... | StarcoderdataPython |
1775750 | <filename>Data Scientist Career Path/11. Foundations of Machine Learning Supervised Learning/3. Multiple/1. intro.py
import codecademylib3_seaborn
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
from sklearn.linear_model import LinearRegression
from skle... | StarcoderdataPython |
3336302 | <reponame>LaudateCorpus1/python-storage-clients
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (C) Copyright 2017-2019 Hewlett Packard Enterprise Development LP
#
# 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
... | StarcoderdataPython |
3396429 | import shlex, shutil, json
class enable_menu_build_flowEventListener(enable_menu_project_typeEventListener):
path = os.path.join(PROJECT_FOLDER, "flow", "Main.sublime-menu")
path_disabled = os.path.join(PROJECT_FOLDER, "flow", "Main_disabled.sublime-menu")
class build_flowCommand(manage_cliCommand):
isNode = T... | StarcoderdataPython |
1676274 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 13:22:26 2018
@author: <NAME> <<EMAIL>>
"""
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from cartomap import geogmap as gm
from glob import glob
from dateutil import parser
import h5py, os
impor... | StarcoderdataPython |
1785994 | useOriginal = 1
baseURL = "http://weihang-wang.github.io/cse705/project"
def getConfig():
if useOriginal == 0:
return baseURL + "/lenovo/Y40_80.html"
else:
return "https://cse.buffalo.edu/~bthorat/"
| StarcoderdataPython |
3373614 | #!/usr/bin/env python
# coding: utf-8
__authors__ = ["<NAME>"]
__license__ = "MIT"
__date__ = "12/12/2018"
from .fft import FFT
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.