id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
11391681
# 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 Lookout for Equipment" prefix = "lookoutequipment" class Action(BaseAction): def __init__(self, action: str = None) -> N...
StarcoderdataPython
4897173
<reponame>EvgenDEP1/python-adv numbers = {chr(el) for el in range(ord('0'), ord('9') + 1)} numbers.update(['.', ',']) required_symbol = {'.'} def numbers_is_valid(number): numbers_as_set = set(number) if not number or numbers_as_set - numbers: return False for tochka in required_symbol: ...
StarcoderdataPython
9629912
import os from datetime import timedelta import django from django.core.exceptions import ValidationError from celery import Celery django.setup() from db.models import FeedSource from lib.main import create_new_feed from utils.parse import parse_new_feeds celery = Celery( __name__, broker=os.environ.get( ...
StarcoderdataPython
1849005
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created by <NAME> Interwave Analyzer modelling function modififications to previosly versions must be specified here using WAVE codes: W-23.05-1.00.0-00 A-01.05-1.00.3-00 V-22.05-1.00.4-00 E-05.05-1.00.4-00 """ import numpy as np import math as ma from...
StarcoderdataPython
98381
<filename>chatbot_m.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import random import pandas as pd import stt import tts # from DiabloGPT import Chat from chinese_convo import chinese_chatbot import gesture from multiprocessing import Process,Pipe class Chatbot: def __init__(self, isActing=True, sLang='en',...
StarcoderdataPython
3565502
import numpy as np import math from mgcpy.independence_tests.utils.transform_matrices import \ transform_matrices import scipy.io import os def power(independence_test, sample_generator, num_samples=100, num_dimensions=1, theta=0, noise=0.0, repeats=1000, alpha=.05, simulation_type=''): ''' Estimate power...
StarcoderdataPython
5078697
#!/usr/bin/env python3 # Generate an LED gamma-correction table gamma = 2.8 # Correction factor max_in = 255 max_out = 255 print("// Format this before using") print("const GAMMA8: [u8; 256] = [") for i in range(max_in + 1): print(str(int(pow(i/max_in, gamma) * max_out + 0.5)) + ", ") print("];")
StarcoderdataPython
8115686
<gh_stars>0 import math def get_factor_list(n): """ Use trial division to identify the factors of n. 1 is always a factor of any integer so is added at the start. We only need to check up to n/2, and then add n after the loop. """ factors = [1] for t in range(2, (math.ceil((n / 2) + 1))...
StarcoderdataPython
9680569
<reponame>ludoo/wpkit import sys import logging from django.db import connection from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from django_nose.tools import * from wpkit.models import Site, DB_PREFIX logger = logging.getLogger('wpkit.test.m...
StarcoderdataPython
11212468
<filename>core/teacher_student.py from functools import partial from pathlib import Path import argparse import copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms from core.teachers import MotionToStaticTeacher from core.eisen import EISEN from ...
StarcoderdataPython
3558045
import numpy def FreedmanDiaconisBinSize(feature_values): """ The bin size in FD-binning is given by size = 2 * IQR(x) * n^(-1/3) More Info: https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule If the BinSize ends up being 0 (in the case that all values are the same), return a BinSize of 1. """ ...
StarcoderdataPython
1762509
<gh_stars>0 import json from datetime import timedelta from django.contrib.auth.models import User, Permission from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase from django.urls import reverse from django.utils import timezone from news.models import Article, Event, TimePl...
StarcoderdataPython
6611198
<reponame>dlenwell/judo-python-client<gh_stars>1-10 """ Copyright 2020 <NAME>, Judo Security inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless r...
StarcoderdataPython
1848712
import multiprocessing class holderClass(): def __init__(self): self.x = 12 def increment(self,in_q,out_q): while in_q: object_class = in_q.get() object_class.x = object_class.x + 1 out_q.put(object_class) class testClass(): def __init__(self):...
StarcoderdataPython
1631056
<gh_stars>0 import redis from app.config import REDIS_HOST, REDIS_PASSWORD def redis_connection(): if REDIS_HOST: return redis.StrictRedis( host=REDIS_HOST, password=<PASSWORD>_PASSWORD)
StarcoderdataPython
1861677
from nonebot.rule import to_me from nonebot.plugin import on_command from nonebot.typing import Bot, Event say = on_command("say", to_me()) @say.handle() async def repeat(bot: Bot, event: Event, state: dict): await bot.send(message=event.message, event=event)
StarcoderdataPython
34888
<gh_stars>0 import h5py import numpy import sklearn import sklearn.datasets from matplotlib import pyplot def load_dataset(): data_dir = '/Users/fpena/Courses/Coursera-Deep-Learning/Assignments/datasets/' train_dataset = h5py.File(data_dir + 'train_catvnoncat.h5', "r") train_set_x_orig = numpy.array(trai...
StarcoderdataPython
1777859
<reponame>AnonC0DER/C1Academy<filename>Teacher/migrations/0005_auto_20220123_2338.py # Generated by Django 3.2.9 on 2022-01-23 20:08 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('Teacher', '0004_auto_20220121_0034'), ] operations ...
StarcoderdataPython
274749
<gh_stars>0 from .api import Sampler, read, run from .utils import instance_from_map
StarcoderdataPython
6660043
#Write a simple program to simulate the operation of the grep command on Unix. #Ask the user to enter a regular expression and count the number of lines that matched #the regular expression: import re fname = input('Enter the file name: ') #prompts user for file name to search try: fhand = open(fname, 'r') #o...
StarcoderdataPython
3557671
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP # 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/LICEN...
StarcoderdataPython
9631812
# Copyright 2020-, <NAME> and contributors # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. import numpy as np import pytest from quantumflow import var funcnames = ["arccos", "arcsin", "arctan", "cos", "exp", "sign", "s...
StarcoderdataPython
9680952
<reponame>FapTek/faopy-server import logging import traceback def t(t): def type_decorator(func): def wrapped(self, arg): if type(arg) == t: return func(self, arg) else: logging.warning(f"Type mismatch in call to {func.__name__}: expected {t}, got {ty...
StarcoderdataPython
8032016
import discord from discord.ext import commands class TB_Settings(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(name='setup', aliases=['tsetup'], description='Initialize guild') @commands.has_permissions(manage_guild=True) @commands.bot_has_permissions(man...
StarcoderdataPython
6434041
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from copy import copy import unittest import numpy as np from coremltools._deps import HAS_SKLEARN from...
StarcoderdataPython
6594124
from aipaca_predictor.dnn import DNN from aipaca_predictor.layers import PoolLayer from aipaca_predictor.layers import ConvLayer from aipaca_predictor.layers import DenseLayer import requests import json from typing import List from typing import Optional from tensorflow.python.client import device_lib from tensorflow....
StarcoderdataPython
134008
<filename>mlonmcu/context.py # # Copyright (c) 2022 TUM Department of Electrical and Computer Engineering. # # This file is part of MLonMCU. # See https://github.com/tum-ei-eda/mlonmcu.git for further info. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complia...
StarcoderdataPython
6502690
import os import importlib from abc import ABC, abstractmethod PLUGINS = {} class Plugin(ABC): @abstractmethod def __call__(self, input: str) -> str: pass class NameConflictError(Exception): def __init__(self, message): self.message = message def register_plugin(name: str, description...
StarcoderdataPython
9716363
<reponame>homm/pillow-lut-tools from __future__ import division, unicode_literals, absolute_import import warnings from pillow_lut import operations, generators, ImageFilter, Image from pillow_lut import (identity_table, transform_lut, resize_lut, amplify_lut, sample_lut_linear, sample_lut_cub...
StarcoderdataPython
3206549
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Mon Feb 05 11:55:37 2018 @author: hugonnet SHELL LIBRARY: Library of Python functions for file, directory and path manipulation LIST: """ from __future__ import print_function import os, sys import shutil import tarfile, zipfile from contextlib import contextmanager...
StarcoderdataPython
5184961
"""Example: using ymlref, resolving references to remote document.""" from io import StringIO import ymlref DOCUMENT = """ db_name: people content: $ref: https://raw.githubusercontent.com/dexter2206/ymlref/feature/external-references/examples/people.yml """ def main(): """Entrypoint for this example.""" d...
StarcoderdataPython
11216637
<filename>python/other_sources/Go_Game.py #!/usr/bin/env python3 # https://leetcode.com/discuss/interview-question/391195/ import typing import unittest class DFSError(Exception): pass def go_name(board: typing.List[typing.List], x: int, y: int) -> int: m = len(board) if not m: return 0 n = ...
StarcoderdataPython
6620143
<gh_stars>1000+ #!/usr/bin/python # -*- encoding: utf-8 -*- from __future__ import with_statement import os import os.path class ChangeDirectory(object): """ ChangeDirectory is a context manager that allowing you to temporary change the working directory. >>> import tempfile >>> td = os.path.real...
StarcoderdataPython
5023775
import argparse arg_lists = [] parser = argparse.ArgumentParser(description='RAM') def str2bool(v): return v.lower() in ('true', '1') def add_argument_group(name): arg = parser.add_argument_group(name) arg_lists.append(arg) return arg # glimpse network params glimpse_arg = add_argument_group('Gli...
StarcoderdataPython
4991051
<reponame>FlanFlanagan/raven<gh_stars>100-1000 # Copyright 2017 Battelle Energy Alliance, 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 # ...
StarcoderdataPython
12850864
from k5test import * # Test that the kdcpreauth client_keyblock() callback matches the key # indicated by the etype info, and returns NULL if no key was selected. testpreauth = os.path.join(buildtop, 'plugins', 'preauth', 'test', 'test.so') conf = {'plugins': {'kdcpreauth': {'module': 'test:' + testpreauth}, ...
StarcoderdataPython
1813055
<gh_stars>10-100 import random import table import requests import crawler class Proxy: def __init__(self, proto, url): self.proto = proto self.url = url def proxy_download(self): try: result = requests.get(str.rstrip(self.url)) result.raise_for...
StarcoderdataPython
4986580
<filename>wms/views.py from math import pi import mapscript from PIL import Image from raster.models import RasterTile from django.http import HttpResponse from django.views.generic import View from wms.maps import WmsMap class WmsView(View): """ WMS view class for setting up WMS endpoints. """ map...
StarcoderdataPython
364605
<reponame>bohyn/yawd-elfinder<gh_stars>0 import os def fs_standard_access(attr, path, volume): """ Make dotfiles not readable, not writable, hidden and locked. Should return None to allow for original attribute value, boolean otherwise. This can be used in the :ref:`setting-accessControl` setting. ...
StarcoderdataPython
17104
<filename>AutocompleteHandler.py import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import simplejson from QueryHandler import QueryHandler class AutocompleteHandler(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self): if not self.request.arguments or self....
StarcoderdataPython
4874225
# coding: utf-8 from form import * from .error import * from .serve import * from .sitemap import * from .warmup import * from .auth import *
StarcoderdataPython
1685873
<gh_stars>0 from django.urls import path from . import views from django.conf.urls.i18n import i18n_patterns urlpatterns = [ # path('', views.BlogListView.as_view(), name="blog"), path('', views.BlogList, name="blog"), path('<int:pk>/', views.BlogDetailView.as_view(), name="single_blog"), ]
StarcoderdataPython
388093
""" Pillowfight Class to run various workloads and scale tests """ import time import logging import tempfile import re from os import listdir from os.path import join from shutil import rmtree from ocs_ci.utility.spreadsheet.spreadsheet_api import GoogleSpreadSheetAPI from ocs_ci.ocs.ocp import OCP from ocs_ci.ocs.re...
StarcoderdataPython
9607233
<reponame>GodOfOwls/Lightshield #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from setuptools import setup, find_packages def open_local(filename): """Open a file in this directory.""" heredir = os.path.abspath(".") return open(os.path.join(heredir, filename), "r") def read_requir...
StarcoderdataPython
3335994
<reponame>cristicismas/top-budget<gh_stars>0 from rest_framework import serializers from expenses.models import Expense, Category, Location, Source class ExpenseSerializer(serializers.ModelSerializer): class Meta: model = Expense fields = '__all__' class CategorySerializer(serializers.ModelSeriali...
StarcoderdataPython
3284628
class InstanceReferenceGeometry(GeometryBase,IDisposable,ISerializable): """ InstanceReferenceGeometry(instanceDefinitionId: Guid,transform: Transform) """ def ConstructConstObject(self,*args): """ ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int) """ pass def Dispose(self):...
StarcoderdataPython
5070690
<reponame>gideontong/CodeQuest<filename>library/python/sort/quick_sort.py """ Source: Interactive Python The quick sort uses divide and conquer to gain the same advantages as the merge sort, while not using additional storage. As a trade-off, however, it is possible that the list may not be divided in half. When this ...
StarcoderdataPython
1741917
from django.apps import AppConfig class GhuMainConfig(AppConfig): name = 'ghu_main' verbose_name = 'GHU (Main)'
StarcoderdataPython
1958614
<reponame>spotx/telepresence # Copyright 2018 Datawire. 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 requ...
StarcoderdataPython
6619594
# Space: O(n) # Time: O(n) class Solution: def longestConsecutive(self, nums): if not nums: return 0 nums = sorted(list(set(nums))) res = 0 counter = 1 index = 1 while index < len(nums): if nums[index] == nums[index - 1] + 1: counter += 1...
StarcoderdataPython
11230018
<filename>games/views.py from django.shortcuts import render, redirect, get_object_or_404 from .models import * from .forms import * from .games.games import games def browse_view(request): boards = Board.boards.all()#.filter(state__outcome=-1) return render(request, 'games/browse.html', { 'boards': ...
StarcoderdataPython
9651165
<filename>src/ToolsTab/__init__.py from .ToolsTab import * from .Tool import *
StarcoderdataPython
92
"""Timezone helper functions. This module uses pytz when it's available and fallbacks when it isn't. """ from datetime import datetime, timedelta, tzinfo from threading import local import time as _time try: import pytz except ImportError: pytz = None from django.conf import settings __all__ = [ 'utc',...
StarcoderdataPython
64515
import json import random from typing import NamedTuple, Any import numpy from numpy.testing import assert_array_almost_equal, assert_almost_equal import torch import pytest from flaky import flaky from allennlp.common.checks import ConfigurationError from allennlp.common.testing import AllenNlpTestCase from allennlp...
StarcoderdataPython
6527989
<reponame>Alt-Shivam/colour<gh_stars>0 from .all import MUNSELL_COLOURS_ALL from .experimental import MUNSELL_COLOURS_1929 from .real import MUNSELL_COLOURS_REAL from colour.utilities import CaseInsensitiveMapping __all__ = [ "MUNSELL_COLOURS_ALL", ] __all__ += [ "MUNSELL_COLOURS_1929", ] __all__ += [ "MUN...
StarcoderdataPython
30703
<reponame>HappyKL/mindspore<filename>tests/st/model_zoo_tests/DeepFM/test_deepfm.py # Copyright 2020 Huawei Technologies Co., Ltd # # 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
3542151
<filename>inqbus/rpi/widgets/lines.py from inqbus.rpi.widgets.base.render import Renderer, render_session from inqbus.rpi.widgets.base.widget import Widget from inqbus.rpi.widgets.interfaces.interfaces import IRenderer from inqbus.rpi.widgets.interfaces.widgets import ILinesWidget from inqbus.rpi.widgets.line import Li...
StarcoderdataPython
321726
# This program takes a raster color image and produces its raster color halftone using patterning algorithm . # Split the image into C, M, Y, K. # Rotate each separated image by 0, 15, 30, and 45 degrees respectively. # Take the half-tone of each image (dot size will be proportional to the intensity). # Rotate back eac...
StarcoderdataPython
3259640
<filename>src/tts_modules/synthesizer/synthesizer_manager.py import torch from tts_modules.synthesizer.configs.hparams import hparams # from tts_modules.synthesizer.utils import audio from tts_modules.synthesizer.utils.symbols import symbols from tts_modules.synthesizer.utils.text import text_to_sequence from tts_modul...
StarcoderdataPython
3502055
<filename>experiments/mj60/dead_time.py import pandas as pd import sys import numpy as np import scipy as sp import json import os from decimal import Decimal import scipy.optimize as opt from scipy.optimize import minimize, curve_fit from scipy.special import erfc from scipy.stats import crystalball from scipy.signal ...
StarcoderdataPython
394152
# -*- coding: utf-8 -*- # (c) 2009-2021 <NAME> and contributors; see WsgiDAV https://github.com/mar10/wsgidav # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php """ Run the [Litmus test suite](http://www.webdav.org/neon/litmus/) against WsgiDAV server. ## Usage **NOTE:** replace <H...
StarcoderdataPython
5166761
import cv2 import time import os import openface import pickle imgDim = 96 cuda = True modelDir = '/home/ubuntu/openface/models' dlibModelDir = os.path.join(modelDir, 'dlib') openfaceModelDir = os.path.join(modelDir, 'openface') networkModel = os.path.join(openfaceModelDir, 'nn4.small2.v1.t7') net = openface.To...
StarcoderdataPython
11350597
from __future__ import absolute_import from __future__ import division from __future__ import print_function import autoinstall_lib as atl version = "fftw-3.2.2" tool = "fftw3" print("-> loading %s autoinstall (using version %s)"%(tool,version)) def options(opt): atl.add_lib_option(tool,opt,install=True) def c...
StarcoderdataPython
278141
print('====== EX 015 ======') dias = int(input('Quantos dias o carro foi alugado: ')) km = float(input('E quantos Km foram percorridos: ')) p = (dias * 60) + (km * 0.15) print('O total a pagar é de R${:.2f}'.format(p))
StarcoderdataPython
72467
# # Copyright (c) 2015-2021 University of Antwerp, Aloxy NV. # # This file is part of pyd7a. # See https://github.com/Sub-IoT/pyd7a for further info. # # 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 Lice...
StarcoderdataPython
1748218
<reponame>Vyshnavmt94/HackerRankTasks<filename>Hackerrank_codes/find_percentage.py """ The provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal. Example ...
StarcoderdataPython
4896390
<reponame>cortwave/carvana-image-masking<filename>src/rle_encoder.py import numpy as np def rle_encode(mask_image): pixels = mask_image.flatten() runs = np.where(pixels[1:] != pixels[:-1])[0] + 2 runs[1::2] = runs[1::2] - runs[:-1:2] return ' '.join(str(x) for x in runs)
StarcoderdataPython
12813999
<reponame>tirkarthi/cloudify-cli ######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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.or...
StarcoderdataPython
3466369
<gh_stars>0 from linked_lists.linked_list import LinkedList class LinkedListQueue: __linked_list: LinkedList = LinkedList() def enqueue(self, item: int): self.__linked_list.add_last(item) def dequeue(self): self.__linked_list.remove_first() def peek(self) -> int: return self...
StarcoderdataPython
3517654
# -*- coding: utf-8 -*- from __future__ import unicode_literals class TeamSummary(object): def __init__(self, nfl_teams_root): self.nfl_teams_root = nfl_teams_root @property def division_roots(self): division_xpath = '//div[contains(@class, "mod-teams-list-medium")]' return self....
StarcoderdataPython
9714560
<reponame>shanioren/argo-workflow-tools import pytest import yaml from argo_workflow_tools import dsl, Workflow from argo_workflow_tools.dsl.expression import Expression @dsl.Task(image="python:3.10") def create_data(): message = {"message": "hello"} return message @dsl.Task(image="python:3.10") def print_...
StarcoderdataPython
3582378
from .trader import Trader
StarcoderdataPython
1991960
"""Defines URL patterns for the GEBA website Blog app""" from django.urls import re_path from . import views urlpatterns = [ # displays blogs in order from latest to newest re_path(r'^$', views.BlogIndexView.as_view(), name='index'), # P => named groups <pk> => pk = primary key which is the ID of the Blo...
StarcoderdataPython
1625596
<gh_stars>10-100 from .pos_embed import * from .rel_multi_head import * from .rel_bias import * from .memory import * from .scale import * from .transformer_xl import * from .loader import * from .sequence import * __version__ = '0.13.0'
StarcoderdataPython
1863166
<reponame>lunika/richie """ ElasticSearch course document management utilities """ from collections import namedtuple from datetime import MAXYEAR from django.conf import settings import arrow from ..defaults import FILTERS_HARDCODED, RESOURCE_FACETS from ..exceptions import IndexerDataException, QueryFormatExceptio...
StarcoderdataPython
11327004
<gh_stars>100-1000 import snap edgefilename = "imdb_actor_edges.tsv" nodefilename = "imdb_actors_key.tsv" context = snap.TTableContext() edgeschema = snap.Schema() edgeschema.Add(snap.TStrTAttrPr("srcID", snap.atStr)) edgeschema.Add(snap.TStrTAttrPr("dstID", snap.atStr)) edgeschema.Add(snap.TStrTAttrPr("edgeattr1", s...
StarcoderdataPython
1827699
<filename>src/evidently/analyzers/base_analyzer.py #!/usr/bin/env python # coding: utf-8 import abc from typing import Optional import pandas as pd from dataclasses import dataclass from evidently.options import OptionsProvider from evidently.pipeline.column_mapping import ColumnMapping from evidently.analyzers.utils...
StarcoderdataPython
3364519
from __future__ import print_function, unicode_literals import logging import os logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.DEBUG) # dirs DATA_DIR = 'data/bot/' class BadWordException(Exception): pass class RepetitionException(Exception): pass def read(name): with op...
StarcoderdataPython
4851881
<reponame>waysuninc/pyinapp class InAppValidationError(Exception): """ Base class for all validation errors """
StarcoderdataPython
4888501
<reponame>dperl-sol/cctbx_project from __future__ import absolute_import, division, print_function from wxtbx.phil_controls import path, ints from wxtbx import phil_controls from wxtbx import icons, app import wx from libtbx.utils import Sorry import os RSTBX_SELECT_IMAGE_IDS = 1 class SelectDatasetPanelMixin(object...
StarcoderdataPython
8075425
<filename>vanir/core/account/utils.py from django.http import HttpResponse from django.template import loader def exchange_view_render( template_name: str, response, request, **kwargs ) -> HttpResponse: """ Helper for extra views in account :param template_name: Template name to render :type templ...
StarcoderdataPython
6665587
import os from os.path import dirname, join import pytest from pypi_simple import PYPI_SIMPLE_ENDPOINT, parse_simple_index DATA_DIR = join(dirname(__file__), os.pardir, "data") def test_empty(): with pytest.warns(DeprecationWarning): projects = list(parse_simple_index("", PYPI_SIMPLE_ENDPOINT)) asser...
StarcoderdataPython
6601126
from datetime import datetime import os import pandas as pd import numpy as np import torch as t from utils.utils import load_nii, read_img, resize_volume, keep_largest_connected_components, crop_volume, \ reconstruct_volume from utils.timer import timeit from metric import metrics class Evaluator: """ ...
StarcoderdataPython
5014689
# coding: utf-8 import datetime from datetime import datetime as dt from importlib import import_module import numpy as np import pandas as pd def get_available_drivers() -> dict: try: module = import_module('src.infrastructure.clients.provider') except ImportError: raise ImportError('Unable...
StarcoderdataPython
4837803
<filename>examples/intrp_diff_example.py ''' Example script for intpdiff spxll'16 ''' # from os import system system('clear') # from positive import * from matplotlib.pyplot import * from numpy import * # t = linspace(0,12*pi,1e3) # y0 = cos(t) # y1 = intrp_diff( t, y0 ) y2 = intrp_diff( t, y0, n = 2 ) # pks,...
StarcoderdataPython
6634711
<reponame>hamburgcodingschool/L2C-Python-1804<gh_stars>0 def sizeOfLongest(array): longest = 0 for word in array: if len(word) > longest: longest = len(word) return longest def printStars(number): starString = "" for i in range(0, number): starString += "*" print(st...
StarcoderdataPython
4825623
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division import numpy as np from gym import spaces import neurogym as ngym class MatchingPenny(ngym.TrialEnv): """Matching penny task. The agent is rewarded when it selects the same target as the computer. opponent_type: Type of oppon...
StarcoderdataPython
1854218
from bitmovin_api_sdk.encoding.configurations.audio.he_aac_v2.customdata.customdata_api import CustomdataApi
StarcoderdataPython
172937
"""Implementation of Model-Free Policy Gradient Algorithms.""" import torch.nn.modules.loss as loss from torch.optim import Adam from rllib.algorithms.ac import ActorCritic from rllib.policy import NNPolicy from rllib.value_function import NNQFunction from .on_policy_agent import OnPolicyAgent class ActorCriticAge...
StarcoderdataPython
9614977
import board as GB import numpy as np import background as bg import secnery as sc import os import time clear = lambda: os.system('clear') alien_type1_list=[] alien_type2_list=[] second_list=[] econ=True class Mario(GB.Codi): mario_img=np.array([[" " for i in range(0,2)] for j in range(0,3)]) ...
StarcoderdataPython
9788594
<reponame>dondongwon/CC_NCE_GENEA<gh_stars>1-10 import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import subprocess import torch import torch.nn as nn import torch.nn.functional as F import torch.optim.lr_schedu...
StarcoderdataPython
243947
import librarian import operator import model.tagger as tagger from nltk.tokenize import TweetTokenizer ### TEXT PROCESSING METHODS ### def split_into_sentences(text): tokenizer = TweetTokenizer() return tokenizer.tokenize(text) def split_into_words(sentence): tokenizer = TweetTokenizer() punctuation = ['.', ','...
StarcoderdataPython
3432886
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-11-26 04:15 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('take_a_number', '0004_remove_officehourssession_instructor_code'), ] operations = [...
StarcoderdataPython
1679905
np.savez_compressed(filename, x, y, z)
StarcoderdataPython
3507289
<gh_stars>0 # Copyright IBM Corp, All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # import logging import os import sys import uuid from flask import Blueprint from flask import request as r sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) from common import log_handler, LOG_LEVEL, \...
StarcoderdataPython
349357
#!/usr/bin/env python ''' This file is part of the PyMSRPC project and is licensed under the project license. ndr.py This are the functions that provide all the NDR data types. It handles serialization and everything. I have spent a shit load of time on this and yet they are not 100%. ...
StarcoderdataPython
1772915
<filename>main.py<gh_stars>0 import pygame import pygame.freetype import math import time import sys import random import matplotlib.pyplot as plt #Dupa # initialize pygame pygame.init() FPS = 100 # frames per second fps_clock = pygame.time.Clock() # Ustawianie ekranu WIDTH = 1280 HEIGHT = 900 DISPLAY = pygame.displa...
StarcoderdataPython
11254804
<gh_stars>1-10 # Copyright 2019 IBM 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 applicable law or agreed ...
StarcoderdataPython
4991744
<reponame>Pandinosaurus/pyquickhelper # -*- coding: utf-8 -*- """ @file @brief Magic parser to parse magic commands """ import argparse import shlex from ..loghelper.flog import noLOG class MagicCommandParser(argparse.ArgumentParser): """ Adds method ``parse_cmd`` to :epkg:`*py:argparse:ArgumentParser`. ...
StarcoderdataPython
12815184
<filename>backtracking/match_parenthesis.py def generate_parentheses(n): """ generate all the different ways you can have n parentheses - nested - adjacent - mixture each of the combos is a str return an array of all the strings good case of backtracking n = 3 two ...
StarcoderdataPython