id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6687478
<filename>examples/function.py from superprocessor import cmd print(cmd( 'function foo { echo "Hello $1\n" ; } ; foo "jonas" ; ' ))
StarcoderdataPython
273253
<filename>online/admin.py from django.contrib import admin from .models import * from csvexport.actions import csvexport # Register your models here. class item(admin.ModelAdmin): list_display = ('title','price','category','brand','status','label','image') search_fields = ['title','description'] list_filter...
StarcoderdataPython
8016124
<reponame>reticulatingspline/WebHooks ### # Copyright (c) 2014, spline # All rights reserved. # # ### from supybot.test import * class WebHooksTestCase(PluginTestCase): plugins = ('WebHooks',) def testWebHooks(self): pass # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
StarcoderdataPython
1614424
<gh_stars>0 from .readDB import * from nltk.corpus import wordnet import sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from .preProcessing import preProcessing import random def synonyms(query, query_processed) : candidate = [[] for i in range(len(query_processed))] count=0...
StarcoderdataPython
4976467
# import storage_module.config_data as config_data # import universal_module.utils # import logging # import sys # logger = logging.getLogger("Main") # sys.excepthook = universal_module.utils.log_exception_handler class RAMStorage: def __init__(self): self.total_messages_read: int = 0 self.total...
StarcoderdataPython
9640362
<reponame>thenetcircle/dino import sys from subprocess import PIPE from subprocess import Popen from flask import Flask from flask import make_response from flask_restful import Api from flask_restful import Resource app = Flask(__name__) api = Api(app) UNIT = sys.argv[4] class Logs(Resource): def __init__(self...
StarcoderdataPython
5078279
<filename>wyeusk/wyeusk.py<gh_stars>0 """Main module.""" import bs4 as bs import urllib.request sauce = urllib.request.urlopen('https://www.fishingpassport.co.uk/salmon-catches').read() soup = bs.BeautifulSoup(sauce, 'html.parser')
StarcoderdataPython
1723366
<reponame>JohnyEngine/CNC import ocl import pyocl import camvtk import time import vtk import datetime import math def drawEdge(myscreen, a, b): myscreen.addActor(camvtk.Sphere(center=(a.x,a.y,a.z), radius=0.0351, color=camvtk.green)); myscreen.addActor(camvtk.Sphere(center=(b.x,b.y,b.z), radius=0.0351, color=...
StarcoderdataPython
3571138
<gh_stars>1-10 from __future__ import absolute_import from __future__ import print_function from __future__ import division DIGITS = '0123456789ABCDEF' def decimal_to_base2(dec): """Convert decimal number to binary number by iteration. Time complexity: O(d/2). Space complexity: O(d/2). """ # Pus...
StarcoderdataPython
6488873
""" Test mvGenericRegrid class $Id: testMvGenericRegrid.py 2354 2012-07-11 15:28:14Z pletzer $ """ import cdat_info import cdms2 import numpy import unittest import regrid2 import ESMP import sys PLOT = False if PLOT: import matplotlib.pylab as pl HAS_MPI = False try: from mpi4py import MPI HAS_MPI = Tr...
StarcoderdataPython
1807238
<filename>tests/features/steps/expanded.py<gh_stars>1000+ # -*- coding: utf-8 """Steps for behavioral style tests are defined in this module. Each step is defined by the string decorating it. This string is used to call the step in "*.feature" file. """ from __future__ import unicode_literals import wrappers from be...
StarcoderdataPython
26583
"""An environment to skip k frames and return a max between the last two.""" import gym import numpy as np class MaxFrameskipEnv(gym.Wrapper): """An environment to skip k frames and return a max between the last two.""" def __init__(self, env, skip: int=4) -> None: """ Initialize a new max fr...
StarcoderdataPython
1610325
from pathlib import Path import moonleap.resource.props as P from moonleap import extend, rule from moonleap.verbs import has from titan.react_pkg.reactapp import ReactApp from .props import get_context @rule("react-app", has, "routes:module") def react_app_has_routes_module(react_app, routes_module): routes_mo...
StarcoderdataPython
3263111
"""Git tools for Python.""" from pathlib import Path, PurePosixPath from datetime import datetime import json from copy import copy from git import Repo, InvalidGitRepositoryError # ============================ Custom exceptions ============================= class DirtyRepo(Exception): """Specific exception in...
StarcoderdataPython
9695182
""" Normalized regional hypsometric interpolation ============================================= There are many ways of interpolating gaps in a dDEM. In the case of glaciers, one very useful fact is that elevation change is generally varies with elevation. This means that if valid pixels exist in a certain elevation bi...
StarcoderdataPython
357680
<reponame>ojarva/home-info-display<gh_stars>1-10 from .models import PrintLabel, get_serialized_labels from django.conf import settings from django.http import HttpResponse from django.utils import timezone from django.views.generic import View from reportlab.pdfgen import canvas from reportlab.pdfbase.pdfmetrics impor...
StarcoderdataPython
4811606
<reponame>iamsuman/iv class Solution: def distribute_candies(self, candies, num_people): #TODO solve candies = kn*(kn+1)/2 n = 0 arr = [0] * num_people i = 0 while candies > 0: n += 1 arr[i] += n if n < candies else candies candies -= n ...
StarcoderdataPython
12807674
#!/usr/bin/env python3 for number in range(0, 100): if number % 15 == 0: print('FizzBuzz') elif number % 5 == 0: print('Buzz') elif number % 3 == 0: print('Fizz') else: print(number)
StarcoderdataPython
9680288
<filename>birthday_greetings/utils.py """Utilities for birthday_greetings.""" import datetime import json import typing from birthday_greetings.reader import Reader from birthday_greetings.sender import Sender def parse_date(date_str: str) -> datetime.date: """Parse a date in Y/m/d format.""" return datetim...
StarcoderdataPython
5051037
<filename>tests/r/test_benefits.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.benefits import benefits def test_benefits(): """Test module benefits.py by downloading benefits.csv and t...
StarcoderdataPython
5089668
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-09-01 16:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("studies", "0031_merge_20170828_1227")] operations = [ migrations.RemoveField(model_name=...
StarcoderdataPython
11269574
<reponame>LGordon2/pyresttest<gh_stars>0 #!/usr/bin/env python import sys from pyresttest import resttest resttest.command_line_run(sys.argv[1:])
StarcoderdataPython
5197886
""" This module implements the Needleman-Wunsch Algorithm. The backtracing step is modified to start with maximum score and extend to the top-left and down to bottom-right. This follows one path that contains the maximal matching sequence. This algorithm also implements an X-Drop termination condition. """ import os...
StarcoderdataPython
3295518
import re from math import floor from reportlab.pdfgen import canvas from reportlab.lib.units import inch, cm from reportlab.lib.pagesizes import letter from reportlab.pdfbase.pdfmetrics import stringWidth import json class ExamGenerator: """ Notes on layout: Bottom : y==0 Left:x==0 """ LAYOU...
StarcoderdataPython
1839466
# coding: utf-8 import sublime st_version = int(sublime.version()) if st_version > 3000: from JoomlaPack.lib.inflector.english import English else: from lib.inflector.english import English __all__ = [ 'English' ]
StarcoderdataPython
12810474
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class Mixcr(Package): """MiXCR is a universal framework that processes big immunome data...
StarcoderdataPython
354470
<filename>national_debt/national_debt/spiders/gdp_debt.py<gh_stars>0 import scrapy class GdpDebtSpider(scrapy.Spider): name = 'gdp_debt' allowed_domains = ['worldpopulationreview.com'] # note that here you might need to change http to https start_urls = ['http://worldpopulationreview.com/countries/co...
StarcoderdataPython
11375610
<gh_stars>1-10 #!/usr/bin/python # # Author: <NAME> <<EMAIL>> # # The BSD 3-Clause License # Copyright (c) 2013, SUSE Linux Products GmbH # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Re...
StarcoderdataPython
3235292
text = open('input').read().split('\n\n') groups = [] for g in text: g = g.replace('\n', '') groups.append(len(set(g))) print(sum(groups))
StarcoderdataPython
6607740
<reponame>hannes-holey/hans """ MIT License Copyright 2021 <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 to use, copy, modify...
StarcoderdataPython
11267178
<reponame>brand-fabian/varfish-server import json from django import template register = template.Library() @register.filter def pretty_json(value): return json.dumps(value, indent=4)
StarcoderdataPython
3306851
# ********** Without the int, the second print would error because you can't add strings to numbers age = int(input('Whats your age? ')) print(age) print(age + 1)
StarcoderdataPython
5125333
<filename>ecco2_scripts/read_ecco.py ## read ECCO2 only for one layer and one area import numpy as np import matplotlib.pyplot as plt from netCDF4 import Dataset as ncread import time as tictoc ## local functions def closest(vec,x): #returns the index of vector vec which contains a value that is closest to value...
StarcoderdataPython
9668741
<reponame>wuffi/nwb-conversion-tools from PySide2 import QtCore, QtGui, QtWidgets #class CollapsibleBox(QtWidgets.QWidget): class CollapsibleBox(QtWidgets.QGroupBox): def __init__(self, title="", parent=None): """ Implementation of collapsible boxes: https://stackoverflow.com/a/52617714/11...
StarcoderdataPython
3510394
<filename>bundle_one/tree/bbst/RedBlackTreeNode.py from ..OrderedBinarySearchTreeNode import * class RedBlackTreeNode(OrderedBinarySearchTreeNode): def __init__(self, element, parent, left_child, right_child, is_red = False): OrderedBinarySearchTreeNode.__init__(self, element, parent, left_child, right_child) ...
StarcoderdataPython
8174460
<filename>jina/types/arrays/mixins/getattr.py from typing import Union, List, Tuple, TYPE_CHECKING if TYPE_CHECKING: from ..document import DocumentArray class GetAttributeMixin: """Helpers that provide attributes getter in bulk """ def get_attributes(self, *fields: str) -> Union[List, List[List]]: ...
StarcoderdataPython
74861
from adapters.moes.BRT100TRV import BRT100TRV moes_adapters = { 'BRT-100-TRV': BRT100TRV, # Moes BRT-100-TRV Radiator valve with thermostat }
StarcoderdataPython
6596124
import Algorithmia # get your Algorithmia API Key from https://algorithmia.com/users/#credentials client = Algorithmia.client("YOUR_API_KEY") # one-time configuration of data.world token from https://data.world/settings/advanced # delete this line once completed: client.algo('datadotworld/configure/0.2.0').pipe({"aut...
StarcoderdataPython
4910442
# pylint: disable=C0111,R0903 """Draws a widget with configurable text content. Parameters: * spacer.text: Widget contents (defaults to empty string) """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): ...
StarcoderdataPython
11301564
<reponame>Jette16/spacy-course import spacy # 定义定制化组件 def length_component(doc): # 获取doc的长度 doc_length = ____ print(f"This document is {doc_length} tokens long.") # 返回这个doc ____ # 读取小规模的中文模型 nlp = spacy.load("zh_core_web_sm") # 将组件加入到流程的最前面,打印流程组件名 ____.____(____) print(nlp.pipe_names) # 处理一段文本...
StarcoderdataPython
228617
<filename>server/app/auth/endpoints.py from app.database import get_db from fastapi import APIRouter, Depends, HTTPException, status from fastapi.security import OAuth2PasswordRequestForm from sqlalchemy.orm import Session from app.users.models import User from .exceptions import WrongCredentials from .factories impor...
StarcoderdataPython
8114661
<gh_stars>1-10 import os import platform from contextlib import contextmanager from shutil import copyfile import dask.dataframe as dd import pytest from dask.delayed import Delayed from numpy import array, array_equal, isnan from numpy.testing import assert_allclose, assert_equal from pandas import Series from bgen_...
StarcoderdataPython
6488121
# impy - a post-processor for HYADES implosion simulations # Copyright (c) Massachusetts Institute of Technology / <NAME> # Distributed under the MIT License import tkinter as tk import tkinter.ttk as ttk import platform class Option_Prompt(tk.Toplevel): """Implement a dialog window to prompt a user to select one...
StarcoderdataPython
4900493
<filename>jupyter_book/utils.py """Utility functions for Jupyter Book.""" import string import argparse import os import os.path as op import yaml from . import __version__ ############################################################################## # CLI utilities def print_color(msg, style): endc = "\033[0...
StarcoderdataPython
3365154
from typing import Union from flask import Response from backend.api.handlers.helpers.make_error_response import make_error_response def handle_404(_e: Union[int, Exception]) -> Response: return make_error_response(404, {"Error": "Invalid endpoint"})
StarcoderdataPython
1699735
<gh_stars>0 '''Entry point''' from .app import create_app APP = create_app()
StarcoderdataPython
3594943
<gh_stars>1-10 from sklearn.externals import joblib from dataset import PennFudanDataset from processing import process from classifier import extractor from filteropt import create_pipeline from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt dataset = PennFudanDataset('dataset/PennFudanPed') ...
StarcoderdataPython
161229
<reponame>5voltsgc/brush_wear<filename>brush_wear_gui.py # Import required modules import tkinter as tk from tkinter import ttk import serial # Global Varibles Number_samples = 3 red_first_time = True blue_first_time = True green_first_time = True green_brush = ['[0] item Number', '[1] Fiber ...
StarcoderdataPython
1967112
<reponame>hongxin001/robustdg import sys import numpy as np import argparse import copy import random import json import torch from torch.autograd import grad from torch import nn, optim from torch.nn import functional as F from torchvision import datasets, transforms from torchvision.utils import save_image from torc...
StarcoderdataPython
5025144
import abc from typing import Optional class ConfigType(abc.ABC): name: str path: Optional[str] = "config/phase0.yaml" @classmethod def has_config(cls) -> bool: """ Return ``True`` if this ``ConfigType`` has configuration that should be loaded. """ return cls.path is n...
StarcoderdataPython
1747333
from django.contrib import admin from .models import Website, DataPoint # Register your models here. admin.site.register(Website) admin.site.register(DataPoint)
StarcoderdataPython
3545599
<gh_stars>0 # -*- coding: utf-8 -*- # # tensor_models.py # # Copyright 2020 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. # You may obtain a copy of the License at # # ht...
StarcoderdataPython
3564617
"""Write a function that takes in two numbers and recursively multiplies them together """ def recursive_multiplication(n,m): # base case if n == 1 and m == 1: return 1 elif n == 1: return m elif m == 1: return n elif n == 0 or m == 0: return 0 # recursive case ...
StarcoderdataPython
245616
from dataclasses import dataclass from sqlalchemy import func from pycroft import config from pycroft.model.finance import Split from pycroft.model.user import PreMember, User, Membership @dataclass class OverviewStats: member_requests: int users_in_db: int members: int not_paid_all: int not_pai...
StarcoderdataPython
5102894
#!/usr/bin/env python3 from sklearn.metrics.cluster import normalized_mutual_info_score import numpy as np from subprocess import call from np_loader import * from path_tools import * from ism import * from orthogonal_optimization import * from DimGrowth import * import itertools #from acc import * import socket imp...
StarcoderdataPython
8072156
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Module containing a class which allows access to disparate Python neural network implementations and architectures, united through a common interface. This interface is modelled on the scikit-learn interface. ''' import warnings import math import timeit from sklearn...
StarcoderdataPython
3437
<reponame>mlandriau/surveysim """Simulate stochastic observing weather conditions. The simulated conditions include seeing, transparency and the dome-open fraction. """ from __future__ import print_function, division, absolute_import from datetime import datetime import numpy as np import astropy.time import astrop...
StarcoderdataPython
12819511
import requests import mimetypes # ----------------------------------------------------------------------------- # Globals BASE_URL = "<YOUR_DOMAIN>/rest/api/content" SPACE_NAME = "<YOUR_SPACE_NAME>" USERNAME = "<YOUR_USERNAME>" PASSWORD = "<<PASSWORD>>" def upload_attachment(page_id, filepath): url = BASE_URL ...
StarcoderdataPython
47331
<filename>launch.py<gh_stars>1-10 #!/usr/bin/env python import sys from PyQt5.QtWidgets import QApplication from cad.application import Application if __name__ == '__main__': app = QApplication(sys.argv) workspace = Application() workspace.show() sys.exit(app.exec_())
StarcoderdataPython
198501
<filename>wcics/utils/files.py # -*- coding: utf-8 -*- # Return the contents of a file def load_file(filename): with open(filename, "r") as f: return f.read() # Write contents to a file def write_file(filename, content): with open(filename, "w+") as f: f.write(content) # Append contents to a file def a...
StarcoderdataPython
3404291
<gh_stars>100-1000 import torch import numpy as np import pickle import os img_size=32 classes={ 'train': [1, 2, 3, 4, 5, 6, 9, 10, 15, 17, 18, 19], 'val': [8, 11, 13, 16], 'test': [0, 7, 12, 14] } def _get_file_path(filename=""): return os.path.join('./data', "cifar-100-python/", filename) def...
StarcoderdataPython
358903
from transcode.containers import basereader import ass import numpy from fractions import Fraction as QQ from itertools import islice from transcode.util import Packet class Track(basereader.Track): def __getstate__(self): state = super().__getstate__() state["index"] = self.index state["s...
StarcoderdataPython
3244065
import collections import typing import numpy as np class TrainConfig(typing.NamedTuple): T: int train_size: int batch_size: int loss_func: typing.Callable class TrainData(typing.NamedTuple): feats: np.ndarray targs: np.ndarray DaRnnNet = collections.namedtuple("DaRnnNet", ["encoder", "de...
StarcoderdataPython
6536585
import time import numpy as np from dbscan import DBScan from sklearn import datasets from sklearn.cluster import DBSCAN from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt from itertools import cycle, islice np.random.seed(0) iris = datasets.load_iris() X = iris.data[:, :2] # Looking at...
StarcoderdataPython
6465984
<reponame>EmersonAires/Introducao_a_ciencia_da_computacao_com_Python<gh_stars>0 def cria_matriz(): m = int(input("Digite um número inteiro: ")) n = int(input("Digite um número inteiro: ")) matriz = [] for i in range(m): linha = [] for j in range(n): linha.append(int(input("D...
StarcoderdataPython
9624789
#!/usr/bin/env python3 import sys, json from collections import Counter data_providers = [] with open(sys.argv[1]) as f: for line in f: rec = json.loads(line) #for record in rec: data_providers.append(rec['dataProvider']) counts = Counter(data_providers) for item in list(counts): pr...
StarcoderdataPython
12806784
<filename>admin_list_controls/tests/test_views.py from django.contrib.auth import get_user_model from django.test import RequestFactory from wagtail.contrib.modeladmin.options import ModelAdmin from django_webtest import WebTest from shop.models import Product from admin_list_controls.views import ListControlsIndexView...
StarcoderdataPython
8110268
import time import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from utils import load_citation, sgc_precompute, set_seed from models import get_model from metrics import accuracy import pickle as pkl from args import get_citation_args from time import perf_counte...
StarcoderdataPython
4881247
<reponame>shahbagdadi/py-algo-n-ds from typing import List import bisect class Solution: def medianSlidingWindow(self, nums: List[int], k: int) -> List[float]: window = sorted(nums[:k]) medians = [] for a, b in zip(nums, nums[k:] + [0]): medians.append((window[k//2] + window[~(k...
StarcoderdataPython
3474669
<reponame>akshayka/gavel import os, sys sys.path.append(os.path.dirname(os.path.realpath(__file__))) import cvxpy as cp import numpy as np from policy import Policy, PolicyWithPacking class ThroughputSumWithPerf(Policy): def __init__(self, solver): self._name = 'ThroughputSumWithPerf' self._poli...
StarcoderdataPython
6626100
<filename>trains/utilities/check_updates.py<gh_stars>0 from __future__ import absolute_import, division, print_function import collections import itertools import re import requests import six if six.PY3: from math import inf else: inf = float('inf') class InvalidVersion(ValueError): """ An invalid v...
StarcoderdataPython
4937720
<filename>programs/pyeos/tests/python/cryptokitties/clockauctionbase.py from backend import * from basement import * from auction import Auction from erc721 import ERC721 from backyard.storage import SDict # @title Auction Core # @dev Contains models, variables, and internal methods for the auction. # @notice We omit a...
StarcoderdataPython
11209253
""" Revision ID: 0304a_merge Revises: 0304_remove_org_to_service, 0303a_merge Create Date: 2019-07-29 16:18:27.467361 """ # revision identifiers, used by Alembic. revision = "0304a_merge" down_revision = ("0304_remove_org_to_service", "0303a_merge") branch_labels = None import sqlalchemy as sa from alembic import o...
StarcoderdataPython
8121653
""" genotype.__main__ ~~~~~~~~~~~~~~~~~~~~~ __ ____ ____ ____ _____/ |_ ___.__.______ ____ / ___\_/ __ \ / \ / _ \ __< | |\____ \_/ __ \ / /_/ > ___/| | ( <_> ) | \___ || |_> > ___/ \___ / \___ >___| /\____/|__| / ____|| __/ \___ > /_____/ \/ ...
StarcoderdataPython
6454495
<filename>tests/integrationtests/integrator/connection/inmemory/sqlite/test_connection.py from unittest import TestCase from pdip.integrator.connection.domain.enums import ConnectorTypes from pdip.integrator.connection.types.inmemory.base import InMemoryProvider from pdip.integrator.connection.types.sql.base import Sq...
StarcoderdataPython
8186420
<reponame>NumberAI/python-bandwidth-iris #!/usr/bin/env python from __future__ import division, absolute_import, print_function from future.builtins import super from iris_sdk.models.base_resource import BaseResource from iris_sdk.models.data.dlda_order_response import DldaOrderResponseData XPATH_DLDA_ORDER_RESPONSE...
StarcoderdataPython
1821616
# Copyright 2021 DeepMind Technologies Limited. 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 required by ...
StarcoderdataPython
11231332
import cv2 from time import sleep crop_x,crop_y,crop_w,crop_h = 142,265,338,70 #crop_x,crop_y,crop_w,crop_h = 95,275,330,67 x,y=0,0 img = cv2.imread("/home/pi/Desktop/132710.jpg") cv2.rectangle(img, (x+crop_x, y+crop_y), (x+crop_x + crop_w, y+crop_y + crop_h), (255, 0, 0), 2) cv2.imshow("Test",img) #sleep(500) cv2.wai...
StarcoderdataPython
364650
from lib.mlp import NeuralNetwork import numpy as np if __name__ == "__main__": print("MLP Test usin XOR gate") filename = "XOR.dat" ''' @dataset: array of arrays [ [x1, x1, x2, ..., xn, y], [x1, x1, x2, ..., xn, y], [x1, x1, x2, ..., xn, y] ] ...
StarcoderdataPython
6445008
<reponame>wangji1/test-framework-and-suites-for-android<filename>acs/acs/Device/DeviceLogger/SerialLogger/SerialAnalyzerThread.py """ :copyright: (c)Copyright 2013, Intel Corporation All Rights Reserved. The source code contained or described here in and all documents related to the source code ("Material") are owned ...
StarcoderdataPython
3519641
<filename>boxio.py<gh_stars>0 import functools import itertools import logging from pathlib import Path from typing import Any, List, Optional, Union from boxsdk import BoxAPIException from boxsdk.object import folder as boxfolder import boxapi import fileio logger = logging.getLogger(__file__) def _get_project_na...
StarcoderdataPython
49575
import unittest from rdbtools3.intset import unpack_intset from rdbtools3.exceptions import RDBValueError class TestIntset(unittest.TestCase): def test_3x2bytes(self): val = (b'\x02\x00\x00\x00' # int size b'\x03\x00\x00\x00' # set length b'\x01\x00' # item 1 ...
StarcoderdataPython
9633749
<reponame>PartiallyTyped/Hyperactive<gh_stars>100-1000 from sklearn.datasets import load_breast_cancer from sklearn.model_selection import cross_val_score from rgf.sklearn import RGFClassifier from hyperactive import Hyperactive data = load_breast_cancer() X, y = data.data, data.target def model(opt): rgf = RGF...
StarcoderdataPython
3276557
<reponame>satra/nibabel """ Testing reading DICOM files """ import numpy as np from .. import dicomreaders as didr from .test_dicomwrappers import (dicom_test, EXPECTED_AFFINE, EXPECTED_PARAMS, IO_DATA_PATH, ...
StarcoderdataPython
9607325
<reponame>mpetyx/pyrif<gh_stars>0 from rdflib import Graph, RDF, URIRef from FuXi.Syntax.InfixOWL import OWL_NS, Class # local source: # galenGraph = Graph().parse( # os.path.join(os.path.dirname(__file__), 'GALEN-CABG-Segment.owl')) # remote source: galenGraph = Graph().parse( location="http://python-dlp.goo...
StarcoderdataPython
398143
#!/opt/conda/envs/rapids/bin/python3 # # Copyright (c) 2020, NVIDIA 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 ...
StarcoderdataPython
3232103
""" Copyright (c) 2020 Cisco Systems 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requi...
StarcoderdataPython
11273263
from datastore.reader.flask_frontend.routes import Route from datastore.shared.flask_frontend import ERROR_CODES from tests import assert_error_response from tests.reader.system.util import setup_data from tests.util import assert_success_response data = { "a/1": { "fqid": "a/1", "field_1": "data"...
StarcoderdataPython
1989292
import random print('-=-' * 40) print('Vou pensar em um número de 0 a 1, tente adivinhar em que número eu pensei.') print('-=-' * 40) r = random.randint(0,10) num = 11 cont = 0 while num != r: num = int(input('Qual seu palpite? ')) if num > r: print('Menos... Tente novamente!') if num < r: p...
StarcoderdataPython
1782483
# -*- coding: utf-8 -*- """ Created on Mon May 11 12:17:33 2020 @author: jatin """ import os import cv2 #File Paths filedir = os.path.dirname(os.path.realpath(__file__)) #Get User Name name = input("Enter Name: ") #Create directory directory = os.path.join(filedir, "dataset", name) if not os.path.exists(directory...
StarcoderdataPython
1743203
from typing import Optional import arrow from hypothesis import given, infer, settings from hypothesis.provisional import urls from hypothesis.strategies import builds, fixed_dictionaries, lists, none, text from pydantic import HttpUrl, ValidationError from rsserpent.models.rss import Category, Enclosure, Feed, Guid,...
StarcoderdataPython
11379791
from unittest.mock import MagicMock, patch from django.core.exceptions import ImproperlyConfigured from django.dispatch import Signal from django.test import TestCase, override_settings from pynotify.helpers import (DeletedRelatedObject, SecureRelatedObject, autoload, get_from_context, get_import_path, ...
StarcoderdataPython
344602
from django.db import models from core.models.base import BaseModel from core.models.taxonomic_order import TaxonomicOrder class TaxonomicFamily(BaseModel): class Meta: app_label = 'core' default_permissions = () db_table = 'taxonomic_families' taxonomic_order = models.ForeignKey(Tax...
StarcoderdataPython
9707239
from robocup_env.envs.base.robocup import RoboCup import logging import numpy as np import torch from ddpg import DDPG from wrappers.normalized_actions import NormalizedActions save_dir = "./saved_models" log_dir = "./runs" env_name = "collect" seed = 1337 gamma = 0.99 tau = 0.001 noise_stddev = 0.5 hidden_size = [...
StarcoderdataPython
11257295
<filename>tests/test_utils.py from audacitorch.utils import save_model import torch import audacitorch def test_metadata(broken_metadata, metadata): success, msg = audacitorch.utils.validate_metadata(broken_metadata) assert not success success, msg = audacitorch.utils.validate_metadata(metadata) asse...
StarcoderdataPython
140612
#!/usr/bin/env python import os import os.path as op import pandas as pd import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import seaborn as sns # 1. load a dataset from a file # 2. "organize" that file, so we can access columns *or* rows of it easily # 3. compute some "summary statisic...
StarcoderdataPython
6560892
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # THE VALUES IN THE ENUM ARE AUTO-GENERATED. DO NOT EDIT THIS MANUALL...
StarcoderdataPython
164098
<filename>python/dynamic_graph/sot/torque_control/identification/identify_motor_with_current.py<gh_stars>0 # -*- coding: utf-8 -*- import numpy as np import sys #import dynamic_graph.sot.torque_control.utils.plot_utils as plot_utils import matplotlib as mpl mpl.rcParams['lines.linewidth'] = 4; import matplotlib.pyp...
StarcoderdataPython
9756568
import pyomo.environ as pyomo from pyomo.network import Port from pyomo.environ import units as u from hybrid.dispatch.dispatch import Dispatch class PowerSourceDispatch(Dispatch): """ """ def __init__(self, pyomo_model: pyomo.ConcreteModel, index_set: pyomo.Set, ...
StarcoderdataPython
3477499
<reponame>deepakkt/aasaan<gh_stars>0 # Generated by Django 2.0.4 on 2018-05-08 06:41 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('notify', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='notifier', ...
StarcoderdataPython