id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9745155 | # USAGE
# python /home/nmorales/cxgn/DroneImageScripts/ImageProcess/RemoveBackground.py --image_path /folder/mypic.png --outfile_path /export/mychoppedimages/outimage.png
# import the necessary packages
import argparse
import imutils
import cv2
import numpy as np
import math
# construct the argument parse and parse t... | StarcoderdataPython |
11367794 | <reponame>tdiprima/code
class itemproperty(object):
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
if doc is None and fget is not None and hasattr(fget, "__doc__"):
doc = fget.__doc__
self._get = fget
self._set = fset
self._del = fdel
self.__doc__... | StarcoderdataPython |
6610117 | <filename>bbcprc/old/files.py
import contextlib
import os
def with_suffix(root, suffix=None):
for f in os.listdir(root):
if not suffix or f.endswith(suffix):
yield os.path.join(root, f)
@contextlib.contextmanager
def delete_on_fail(fname, mode='wb', open=open, delete=True):
with open(fna... | StarcoderdataPython |
11207087 | # Copyright 2022 Google LLC.
#
# 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, ... | StarcoderdataPython |
24685 | <gh_stars>1-10
import gzip
import numpy as np
import os
import pandas as pd
import shutil
import sys
import tarfile
import urllib
import zipfile
from scipy.sparse import vstack
from sklearn import datasets
from sklearn.externals.joblib import Memory
if sys.version_info[0] >= 3:
from urllib.request import urlretrie... | StarcoderdataPython |
4925091 | from typing import Optional
from .event import Event
from .event import NONAME
from .output import Output, ConsoleOutput, FileOutput
class Core(Output):
project: str
env: str
console_output: Optional[ConsoleOutput]
file_output: Optional[FileOutput]
"""
Core 维护着日志系统的输出器(包括命令行输出器和文件输出器),保持全局配置... | StarcoderdataPython |
306285 | <gh_stars>10-100
class TestDemo:
print('testing')
| StarcoderdataPython |
16705 | from systems.plugins.index import BaseProvider
import os
class Provider(BaseProvider('task', 'upload')):
def execute(self, results, params):
file_path = self.get_path(self.field_file)
if not os.path.exists(file_path):
self.command.error("Upload task provider file {} does not exist".... | StarcoderdataPython |
3241909 | <reponame>shantanusharma/bigmler<filename>bigmler/whizzml/dispatcher.py
# -*- coding: utf-8 -*-
#
# Copyright 2016-2020 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://ww... | StarcoderdataPython |
6626215 | # Copyright (c) 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'test-compile-as-managed',
'type': 'executable',
'msvs_settings': {
'VCCLCompilerTool': {
... | StarcoderdataPython |
3251813 | # See https://github.com/confluentinc/confluent-kafka-python
from confluent_kafka.admin import AdminClient, NewTopic
app_settings = {
"bootstrap.servers": "TODO",
"topics": [
"topic1",
"topic2",
],
}
a = AdminClient({"bootstrap.servers": app_settings["bootstrap.servers"]})
# Note: In ... | StarcoderdataPython |
4884236 | <reponame>ezekielkibiego/projects254
# Generated by Django 2.2.24 on 2022-02-12 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
... | StarcoderdataPython |
6422045 | <reponame>gembcior/FortressTools<filename>src/fortresstools/command/__init__.py<gh_stars>0
from .base import UnsupportedExecutor
from .dir import *
from .git import *
from .cmake import *
from .pip import *
from .venv import *
from .rsync import *
from .svn import *
from .test import *
| StarcoderdataPython |
6618548 | <reponame>baggakunal/learning-python<filename>src/prime_number.py
from math import sqrt
def is_prime(num: int) -> bool:
if num < 2:
return False
for i in range(2, int(sqrt(num)) + 1):
if num % i == 0:
return False
return True
def main():
print([n for n in range(101) if is... | StarcoderdataPython |
3458579 | from svbench.io_tools import *
from svbench.quant_tools import *
from svbench.loaders import * | StarcoderdataPython |
9659937 | <reponame>MaciejTe/integration
# Copyright 2021 Northern.tech AS
#
# 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 r... | StarcoderdataPython |
5128469 | from .alexnet import AlexNetV1, AlexNetV2, AlexNetV3
from .resnet import ResNet
from .resnet2plus1d import ResNet2Plus1d
from .resnet3d import ResNet3d
from .resnet3d_csn import ResNet3dCSN
from .resnet3d_slowfast import ResNet3dSlowFast
from .resnet3d_slowonly import ResNet3dSlowOnly
from .resnet_tin import ResNetTIN
... | StarcoderdataPython |
8034011 | <reponame>marici/recipebook
# -*- coding: utf-8 -*-
'''
The MIT License
Copyright (c) 2009 Marici, Inc.
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 limi... | StarcoderdataPython |
6665419 | <reponame>sbruch/xe-ndcg-experiments<filename>lib.py<gh_stars>1-10
import math
import numpy as np
import random
import lightgbm as gbm
class SplitConfig(object):
def __init__(self, population_pct, sample_size, transformations=None):
"""Creates a split configuration.
Args:
population_pct: (float) T... | StarcoderdataPython |
372799 | #!/usr/bin/env python3
# pylint: disable=missing-docstring,too-many-public-methods
import pathlib
import shutil
import tempfile
import time
import unittest
import uuid
from typing import List, Optional # pylint: disable=unused-import
import zmq
import persizmq
import persizmq.filter
class TestContext:
def __i... | StarcoderdataPython |
9696920 | # ai.py
#
# Author: <NAME>
# Created On: 21 Feb 2019
import numpy as np
from . import astar
SEARCH_TARGET = 0
MOVE = 1
class AI:
def __init__(self, player):
self.player = player
self.path = []
self.state = SEARCH_TARGET
self.weight_self = 3
self.weight_enemy = 6
se... | StarcoderdataPython |
6537889 | #!/usr/bin/env python2
import random
import math
import copy
from Spell import *
class Pokemon:
def __init__(self, name, baseHp, lifePerLevel, attack, attackPerLevel, baseDef, defencePerLevel, spells, elements):
self.level = 1
self.exp = 0
self.name = name
self.baseHp = baseHp
... | StarcoderdataPython |
6502011 | from attr import Factory, NOTHING
from prettyprinter.prettyprinter import pretty_call_alt, register_pretty
def is_instance_of_attrs_class(value):
cls = type(value)
try:
cls.__attrs_attrs__
except AttributeError:
return False
return True
def pretty_attrs(value, ctx):
cls = type(... | StarcoderdataPython |
11287236 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - 2021 Geode-solutions
#
# 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
# to use, co... | StarcoderdataPython |
6649675 | <reponame>ethansaxenian/RosettaDecode
LONGMONTHS = (1, 3, 5, 7, 8, 10, 12) # Jan Mar May Jul Aug Oct Dec
def fiveweekendspermonth2(start=START, stop=STOP):
return [date(yr, month, 31)
for yr in range(START.year, STOP.year)
for month in LONGMONTHS
if date(yr, month, 31).timetuple(... | StarcoderdataPython |
328889 | from manim import *
class s08b_Algorithms_Activity(Scene):
def construct(self):
# Actors.
title = Text("Algorithms")
subtitle = Text("(Activity)").scale(0.75)
# Positioning.
title.shift(0.50*UP)
subtitle.next_to(title, DOWN)
# Animations.
actors = [title, subtitle]
for actor in actors:
... | StarcoderdataPython |
6656577 | # Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Elastic File System"
prefix = "elasticfilesystem"
class Action(BaseAction):
def __init__(self, action: str = None) -> No... | StarcoderdataPython |
1850660 | <filename>libs/helpers.py
from ncclient import manager
from lxml import etree
def get_running_config(ip, port, uname, pw, device_params):
session = manager.connect(host=ip, port=port, username=uname, password=pw, device_params=device_params, hostkey_verify=False)
config = session.get_config(source='running').d... | StarcoderdataPython |
3519367 | # -*- coding:utf-8 -*-
from conf import *
from utils import *
import abc
class CNNModel(metaclass=abc.ABCMeta):
def __init__(self, param):
# input_shape = x_train.shape[1:]
self.param = param
self.train_poison = None
self.test_poison = None
self.classifier = None
def ... | StarcoderdataPython |
115214 | <filename>yj_anova_test.py
#coding:utf-8
from scipy import stats
import numpy as np
from pandas import Series,DataFrame
from openpyxl import load_workbook
import math
import uuid
import os
def chart(data_ws,result_ws):
pass
def _produc_random_value(mean,stdrange):
b = np.random.uniform(*stdrange)
a = b/ma... | StarcoderdataPython |
4886512 | <gh_stars>0
""" Swagger documentation. """
INDEX = {
"responses": {
"200": {
"description": "A greeting."
}
},
}
| StarcoderdataPython |
8060658 | # -*- coding: utf-8 -*-
from django.shortcuts import HttpResponse, render_to_response
from django.http import HttpResponseRedirect
from django.contrib.admin.views.decorators import staff_member_required
from django.utils.translation import ugettext as _
from grappelli.models.bookmarks import Bookmark, BookmarkItem
fr... | StarcoderdataPython |
9605754 | <reponame>mohibeyki/remoteAPI<filename>remoteAPI/exceptions.py
#!/usr/bin/env python3
from rest_framework import status
class ServiceError(Exception):
"""
Base class for microservice errors
Typically a Http response is generated from this.
"""
def __init__(self, type, message, suggested_http_stat... | StarcoderdataPython |
389815 | <filename>DD/IP/TEMPLATES/Session 3/propContours.py
############################################
## PROJECT CELL
## Image Processing Workshop
############################################
## Import OpenCV
import numpy
import cv2
############################################
## Read the image
img = cv2.imread('map.png')... | StarcoderdataPython |
6544032 | import pandas as pd
import numpy as np
import altair as alt
import streamlit as st
import sys, argparse, logging
import json
def spell(spell_inputs):
mana = spell_inputs
x_col = st.selectbox("Select x axis for line chart", mana.columns)
xcol_string = x_col + ":O"
if st.checkbox("Show as continuous?",... | StarcoderdataPython |
1819465 | #!/usr/bin/env Python3
'''
TypeLoader backend functionality
'''
| StarcoderdataPython |
3460864 | <reponame>danmar3/twodlearn<gh_stars>0
# ***********************************************************************
# General purpose optimizer
#
# Wrote by: <NAME> (<EMAIL>)
# Modern Heuristics Research Group (MHRG)
# Virginia Commonwealth University (VCU), Richmond, VA
# http://www.people.vcu.edu/~mmanic/
... | StarcoderdataPython |
178866 | def _longest_common_subsequence(s1: str, s2: str) -> int:
"""
Let m and n be the lengths of two strings.
Build L[m+1][n+1] from the bottom up.
Note: L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
Runtime: O(mn)
Space Complexity: O(mn)
"""
m, n = len(s1), len(s2)
L = [[0] ... | StarcoderdataPython |
1845176 | <gh_stars>0
import asterid as ad
def asterid_dm_to_dendropy_dm(D, ts):
pdm = dendropy.PhylogeneticDistanceMatrix()
pdm.taxon_namespace = dendropy.TaxonNamespace()
pdm._mapped_taxa = set()
for i in range(len(ts)):
for j in enumerate(ts):
si = ts[i]
sj = ts[j]
... | StarcoderdataPython |
3254314 | <filename>cogs/misc.py
import datetime
import asyncio
import strawpy
import random
import re
import sys
import subprocess
from PythonGists import PythonGists
from appuselfbot import bot_prefix
from discord.ext import commands
from cogs.utils.checks import *
'''Module for miscellaneous commands'''
class Misc:
de... | StarcoderdataPython |
1786879 | <filename>polyA/fill_consensus_position_matrix.py
from typing import Dict, List, Tuple
from .matrices import ConsensusMatrixContainer
from .performance import timeit
@timeit()
def fill_consensus_position_matrix(
row_count: int,
column_count: int,
start_all: int,
subfams: List[str],
chroms: List[s... | StarcoderdataPython |
5089534 | <reponame>lelechen63/idinvert_pytorch
import numpy as np
import cv2, PIL.Image
# show image in Jupyter Notebook (work inside loop)
from io import BytesIO
from IPython.display import display, Image
def show_img_arr(arr, bgr_mode = False):
if bgr_mode is True:
arr = cv2.cvtColor(arr, cv2.COLOR_BGR2RGB)
... | StarcoderdataPython |
8016443 | <filename>caldavclientlibrary/protocol/url.py
##
# Copyright (c) 2007-2016 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | StarcoderdataPython |
3525205 | <filename>prepare_verbs.py
import jsonpickle as jp
from utils import open_file, write_file, collator
jp.set_encoder_options('simplejson', sort_keys=True, indent=4, ensure_ascii=False)
content = open_file('input/monlam_verbs.json')
json = jp.decode(content)
dadrag = open_file('input/dadrag_syllables.txt').strip().spli... | StarcoderdataPython |
End of preview. Expand in Data Studio
- Downloads last month
- 95