id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6663252
<filename>test/channel_test_utils.py # # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # from re import L import tensorflow as tf import numpy as np from functools import wraps from sionna.channel.utils import sample_bernoulli...
StarcoderdataPython
3535441
# https://leetcode.com/problems/maximum-product-subarray/ # seperate the list of nums into chunks using 0 as the delimiter # for each of the chunk # case 1: there are no negative numbers # case 2: even number of negative numbers # case 3: odd number of negative numbers # first two cases are simple # for case 3: calcul...
StarcoderdataPython
1818044
from .v1 import ROVPPV1LiteSimpleAS from .v1 import ROVPPV1SimpleAS from .v2 import ROVPPV2LiteSimpleAS from .v2 import ROVPPV2SimpleAS from .v2 import ROVPPV2aLiteSimpleAS from .v2 import ROVPPV2aSimpleAS from .v2 import ROVPPV2ShortenSimpleAS from .v2 import ROVPPV2ShortenLiteSimpleAS from .rovpp_v3_as import ROVPPV3...
StarcoderdataPython
1826234
# -*- coding: utf-8 -*- """ core exceptions module. """ from pyrin.core.enumerations import ServerErrorResponseCodeEnum, ClientErrorResponseCodeEnum class CoreException(Exception): """ base class for all application exceptions. """ def __init__(self, *args, **kwargs): """ initializes...
StarcoderdataPython
72435
<filename>steps/step49.py if '__file__' in globals(): import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import math import numpy as np import dezero import dezero.functions as F from dezero import optimizers from dezero.models import MLP max_epoch = 300 batch_size = 30 hidden_size ...
StarcoderdataPython
3462214
<reponame>AtosNeves/Beecrowd a, b = input().split(" ") a = int(a) b = int(b) if a % b == 0 or b % a ==0 : print("Sao Multiplos") else: print("Nao sao Multiplos")
StarcoderdataPython
9744780
"""Voce deve criar uma classe carro que vai possuir dois atributos compostos por outras duas classes: 1) Motor 2) Direcao O Motor tera a responsabilidade de contralar a velocidade Ele oferece os seguints atributos: 1) Atributo de dado velocidade 2) Metodo acelerar, que devera incrementar a velocidade de uma unidade 3...
StarcoderdataPython
5192528
from typing import Iterable, Union from draco.asp_utils import blocks_to_program from draco.programs import constraints, definitions, hard, helpers from draco.run import is_satisfiable, run_clingo def check_spec(spec: Union[str, Iterable[str]]) -> bool: """Checks the spec against the hard constraints. Inter...
StarcoderdataPython
1857995
<filename>cashtrack/apps/users/migrations/0002_auto_20200918_1324.py<gh_stars>0 # Generated by Django 2.1.7 on 2020-09-18 12:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AlterModelManag...
StarcoderdataPython
3597708
<reponame>hlibe/FinTech-of-Networks #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 27 15:19:34 2021 @author: HaoLI """ # evaluate gradient boosting algorithm for classification import pandas as pd import numpy as np import os import matplotlib.pyplot as plt from numpy import mean from numpy impo...
StarcoderdataPython
11244987
""" Insert Gaps. Insert a gap at a position of the users choosing (e.g. spam001, gap, spam003). There was almost certainly an easier way to do this... Week one programming for you. Keeping it as it anyway, it was good practice actually working out what I was thinking! """ import os, re, shutil externalInput = input(...
StarcoderdataPython
11201673
#!/usr/bin/env python #----------------------------------------------------------------------------- # Title : PyRogue LMK04828 Module #----------------------------------------------------------------------------- # File : Lmk04828.py # Created : 2017-04-12 #-----------------------------------------------...
StarcoderdataPython
1607725
<gh_stars>10-100 # Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch import torch.distributed as dist from mmcv.runner import get_dist_info def sync_random_seed(seed=None, device='cuda'): """Make sure different ranks share the same seed. All workers must call this function, otherwi...
StarcoderdataPython
1836346
# vim: set encoding=utf-8 # Copyright (c) 2016 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 require...
StarcoderdataPython
8055230
<filename>common/http.py # -*- coding: utf-8 -*- from __future__ import absolute_import from functools import wraps from django import http from django.http import * from django.template.loader import render_to_string from django.shortcuts import render, render_to_response from django.views.generic import base from ...
StarcoderdataPython
245532
__all__ = ["ratio_tanh_x", "logcosh", "multipsi", "GaussianMixtureModel", "rgmm", "HyperbolicSecantMixtureModel", "StudentMixtureModel", "LaplaceMixtureModel", "GumbelMixtureModel"] from util.elementary_function import * from util.prob import *
StarcoderdataPython
8059456
<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> # License: BSD 3 clause """ This module will define the dataset. Thoughts: - Type of model: Classification, Regression, Clustering. - Data: save the dataset. - header: the dataset's header. and so forth. """ # __all__ = [ ...
StarcoderdataPython
5196926
from django.db.models import Count from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from locking.models import NonBlockingLock from .forms import QuestionForm from .models import Questionnaire def index(request): num_answers = Questionnaire.object...
StarcoderdataPython
168288
"""Any function from n inputs to m outputs""" import logging from itertools import zip_longest import pypes.component log = logging.getLogger(__name__) def default_function(*args): "pass" return args class NMFunction(pypes.component.Component): """ mandatory input packet attributes: - data: f...
StarcoderdataPython
3388552
<filename>nm-pso.py<gh_stars>0 import numpy as np from Particle import Particle from mountain_scooter import MountainScooter np.random.seed(11) class InitialPointShapeException(Exception): pass class NM_PSO: """ Class that implement the Nelder-Mead Particle Swarm Optimization algorithm. It take ins...
StarcoderdataPython
380127
#!/usr/bin/env python import climate import io import numpy as np import theanets import scipy.io import os import tempfile import urllib import zipfile import gzip import json init_from_currennt_model = True current_model_file = 'currennt_trained_network.jsn.gz' logging = climate.get_logger('lstm-chime') climate.e...
StarcoderdataPython
3455511
import codecs with codecs.open('data/news.en.heldout-00001-of-00050','r','utf-8') as f: total = 0 k = 0 ll = [] for line in f: ll += ["aa"] total += len(line.strip().split()) k += 1 print ll print total print k
StarcoderdataPython
1679118
<reponame>ShigekiKarita/cupy-examples<filename>plot_pole.py # coding: utf-8 import pylab f = open("pole.log", "r") lines = f.readlines() rewards = [float(l.split()[-1]) for l in lines] def running_mean(x, N): cumsum = numpy.cumsum(numpy.insert(x, 0, 0)) return (cumsum[N:] - cumsum[:-N]) / N r10 = running_mean...
StarcoderdataPython
6599889
from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from sklearn.feature_extraction import text import re class Subreddit: def __init__(self, name, num_submissions, filtered_submission_list, num_submissions_read): self.name = name self.num_submissions = num_submissions ...
StarcoderdataPython
5078684
import json import os import re from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatter import Formatter import utils class JsonFormatter(Formatter): def __init__(self, **options): Formatter.__init__(self, **options) self.theme = options.get('theme') ...
StarcoderdataPython
193980
<filename>openmdao/solvers/linear/linear_runonce.py """Define the LinearRunOnce class.""" from openmdao.solvers.linear.linear_block_gs import LinearBlockGS class LinearRunOnce(LinearBlockGS): """ Simple linear solver that performs a single iteration of Guass-Seidel. This is done without iteration or nor...
StarcoderdataPython
188956
<filename>main.py info_modes = {'login': 'inurl:login | inurl:signin | intitle:Login | intitle:"sign in" | inurl:auth', 'signup': 'inurl:signup | inurl:register | intitle:Signup', 'phpinfo': 'ext:php intitle:phpinfo "published by the PHP Group"'} for info in info_modes: print(info_modes[...
StarcoderdataPython
9614913
<reponame>47lining/quickstart-osisoft-pisystem2aws-connector<gh_stars>0 import os from concurrent.futures import ThreadPoolExecutor import boto3 import functools from lambdas.utils import send_cfnresponse def copy_data(event, source_bucket, source_key, destination_key): submissions_bucket = boto3.resource('s3')....
StarcoderdataPython
79978
<gh_stars>0 # Copyright (c) 2017-2019 Neogeo-Technologies. # 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
4811792
<reponame>tiagoCuervo/dynSysEnv import numpy as np class LorenzSystem: def __init__(self, sigma=10, beta=8/3, rho=28): self.name = 'Lorenz' self.sigma = sigma self.beta = beta self.rho = rho self.numStateVars = 3 def initialize(self): return [0., 1., 1.05] + np...
StarcoderdataPython
109477
<reponame>UICHCC/uicCourse from django.contrib import admin # Register your models here. from . import models # Register your models here. admin.site.register(models.Module) admin.site.register(models.Workload)
StarcoderdataPython
3582314
import os import requests import bz2 from time import sleep import numpy as np import pandas as pd from astropy.io import fits from astropy import wcs def fits_file_name(rerun, run, camcol, field, band): """ SDSS FITS files are named, e.g., 'frame-g-001000-1-0027.fits.bz2'. We will uncompress this and sav...
StarcoderdataPython
1914130
import datetime import pytz from pdb import set_trace from django import template from django_vcs_watch.models import Commit, Repository, Feed, FeedItem from django_vcs_watch.utils import get_user_feed_slug register = template.Library() @register.inclusion_tag('django_vcs_watch/top_repositories.html') def top_reposi...
StarcoderdataPython
181761
<filename>python_crash_course/3-5.py peple = ["gilbert", "david", "richard"] print("welcome to my parlor, " + peple[0]) print("welcome to my parlor, " + peple[1]) print("welcome to my parlor, " + peple[2]) print("richard is too stupid to come, so his not comming.") peple = ["gilbert", "david"] print("welcome to...
StarcoderdataPython
6466407
import sys import types from minecraft_data.v1_8 import windows as windows_by_id from minecraft_data.v1_8 import windows_list from spockbot.mcdata import constants, get_item_or_block from spockbot.mcdata.blocks import Block from spockbot.mcdata.items import Item from spockbot.mcdata.utils import camel_case, snake_cas...
StarcoderdataPython
12820263
<reponame>DurandA/pokemon-battle-api # encoding: utf-8 # pylint: disable=too-few-public-methods,invalid-name """ RESTful API Battle resources -------------------------- """ import logging #from flask_sockets import Sockets import sqlalchemy from flask import Blueprint, request from flask_login import current_user fro...
StarcoderdataPython
4877877
import os import sys import urllib from random import randint from time import sleep BASE_URL = "http://animals.ivolo.me" # from http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python def getTerminalSize(): env = os.environ def ioctl_GWINSZ(fd): try: import ...
StarcoderdataPython
370992
<filename>schooner/ui/teacher/__init__.py __all__ = [ "Assets" ] from .Assets import Assets
StarcoderdataPython
1836243
<gh_stars>0 import os from data_generation.chatbots.visitor_center.chatbot_visitor_center import ( chatbot as visitor_center_chatbot, ) from data_generation.chatbots.input_response.chatbot import ( chatbot as input_response_chatbot, ) from data_generation.chatbots.alice.chatbot import chatbot as alice_chatbot ...
StarcoderdataPython
209608
from lxml import html from bs4 import BeautifulSoup import re def dashboard(self, Session, SchoolId): DASHBOARD_URL = "https://www.lectio.dk/lectio/{}/forside.aspx".format(SchoolId) result = Session.get(DASHBOARD_URL) priority = "" content = "" rowObject = {} output = [] soup = BeautifulSoup(result.text, ...
StarcoderdataPython
8171355
<filename>cloudmesh_todo/objects.py from mongoengine import * from cloudmesh_base.Shell import Shell class CloudmeshEntry(Document): created = DateTimeField() updated = DateTimeField() class Job(CloudmeshEntry): script = StringField(required=True) input = ListField(StringField()) output = Strin...
StarcoderdataPython
11301230
<filename>rapinator/model/static_model.py class StaticModel(object): def sample(self, model_input: str) -> str: return """<<Bizzy Bone - Enduring Fantasy>> [Verse 1: Bizzy Bone] And now the music's getting pushed around And now it all hits me And now they all wish they had me And now it's all the same, bu...
StarcoderdataPython
9785066
<filename>core/server.py import traceback from fastapi import FastAPI, Request, Depends from fastapi.responses import JSONResponse from fastapi.middleware.cors import CORSMiddleware from fastapi.exceptions import RequestValidationError, ValidationError from tortoise.contrib.fastapi import register_tortoise from .rout...
StarcoderdataPython
326895
# encoding: utf-8 from setuptools import setup def install_data_files_hack(): # This is a clever hack to circumvent distutil's data_files # policy "install once, find never". Definitely a TODO! # -- https://groups.google.com/group/comp.lang.python/msg/2105ee4d9e8042cb from distutils.command.install i...
StarcoderdataPython
5015677
<filename>crazydoc/biotools.py import os from copy import deepcopy from Bio.Seq import Seq from Bio import SeqIO from Bio.SeqRecord import SeqRecord try: # Biopython <1.78 from Bio.Alphabet import DNAAlphabet from Bio.Alphabet import generic_protein has_dna_alphabet = True except ImportError: # B...
StarcoderdataPython
12863364
import numpy as np arrs = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) print(arrs[[0,2]])
StarcoderdataPython
5050576
import numpy as np from scipy.optimize import minimize from numpy.linalg.linalg import LinAlgError from numpy.linalg import inv, cholesky from numpy import log, sum, diagonal class Regression: """ Return a function that should be minimized log_likelihood with gradient data involves. """ def __init...
StarcoderdataPython
6492011
<reponame>SUSE/azurectl<filename>azurectl/cli.py # Copyright (c) 2015 SUSE Linux GmbH. 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...
StarcoderdataPython
11240837
<filename>nuscenes/lidar_seg_label_cating.py #%matplotlib inline from nuscenes import NuScenes import os import numpy as np import torch import json import sys import glob import logging logging.basicConfig(level=logging.DEBUG) file_path = "/mrtstorage/users/kpeng/nuscene_pcdet/data/nuscenes/v1.0-trainval/" save_pat...
StarcoderdataPython
9669479
<filename>Python/search-insert-position.py class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """ Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in o...
StarcoderdataPython
9724308
<gh_stars>1-10 from libpyscan import * import libpyscan as lp import random import itertools import math def bounding_box(pts): if not pts: return None min_x = pts[0][0] max_x = pts[0][0] min_y = pts[0][1] max_y = pts[0][1] for pt in pts: min_x = min(min_x, pt[0]) max_...
StarcoderdataPython
1982969
import qanet_xl_modules as layers import qanet_modules as qanet import torch import torch.nn as nn import torch.nn.functional as F class QANetXL(nn.Module): def __init__(self, word_vectors, char_vectors, d_model, d_head, mem_len=80, same_length=False, clamp_len=-1, train_cemb=Fa...
StarcoderdataPython
9627945
<filename>office.py import pandas as pd import numpy as np import math import re from pptx import Presentation from pptx.util import Inches from pptx.util import Pt # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ class ExcelSPC(): filename = None sheets = None ...
StarcoderdataPython
3436937
import asyncio import os import pathlib import zipfile from typing import Dict import aiohttp import yaml async def download_emoji(dest_dir: pathlib.Path, registed_emoji_dict: Dict[str, str]) -> None: limit = 128 sem = asyncio.Semaphore(limit) await get_slack_emoji_from_asserts_dir(sem, dest_dir, regist...
StarcoderdataPython
3530426
import pickle import cv2 as cv import numpy as np from torch.utils.data.dataloader import DataLoader from torch.utils.data.dataloader import default_collate from torch.utils.data.dataset import Dataset from torchvision import transforms from config import im_size, pickle_file class adict(dict): def __init__(sel...
StarcoderdataPython
6671063
import time import os import pickle import pandas import datetime import random import numpy as np import networkx as nx import matplotlib.pyplot as plt import argparse import sys from conf import * from Tool.utilFunc import * import utilis.plot import logging logging.basicConfig(level=logging.INFO) from BanditAlg.C...
StarcoderdataPython
8022017
<reponame>hateganfloringeorge/my_sudoku import pygame as pg class Display: """ docstring """ def __init__(self, game, screen_width, screen_height, offset_height, background_color): self.screen_height = screen_height self.screen_width = screen_width self.screen = pg.display.set...
StarcoderdataPython
9795757
from enum import Enum class LossOpt(Enum): CROSS_ENTROPY = 'cross_entropy' MAX_MARGIN = 'max_margin' class PoolingOpt(Enum): SUM = 1 MAX = 2 AVG = 3
StarcoderdataPython
3295909
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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...
StarcoderdataPython
8191117
import logging from pathlib import Path import pandas as pd import uuid import glob import datetime import olefile from airflow import DAG from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from airflo...
StarcoderdataPython
8001108
<reponame>ayushganguli1769/DevelopmentRobotix<filename>about/views.py<gh_stars>0 from django.shortcuts import render from .models import Convenor,Coordinator,HeadCoordinator,Manager from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from .serial...
StarcoderdataPython
11376050
<reponame>OpenChemistry/oremda from typing import Dict from oremda import operator from oremda.typing import JSONType, PortKey, RawPort, DisplayType, PlotType1D @operator def histograms( inputs: Dict[PortKey, RawPort], parameters: JSONType ) -> Dict[PortKey, RawPort]: z = parameters.get("z", 0) color = p...
StarcoderdataPython
6643925
<reponame>ihgazni2/ndtreepy from efdir import fs import re def update_one(line): regex = re.compile('(.*)("[0-9]+\.[0-9]+\.)([0-9]+)(".*)') groups = regex.search(line) g3 = str(int(groups[3])+1) line = groups[1] + groups[2] + g3 + groups[4] return(line) def rplc_ver(): s = fs.rfile("./setup.p...
StarcoderdataPython
5009154
<gh_stars>0 from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import RegexValidator from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token import dat...
StarcoderdataPython
9619360
<reponame>gcrahay/fir_irma_plugin<filename>standalone/urls.py from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^', include('fir_irma.urls', namespace='irma')), url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'fir_irma/standalone/login.html'}...
StarcoderdataPython
5112537
<gh_stars>1-10 ############################################################################## # Copyright 2017 <NAME> and Others # # # # Licensed under the Apache License, Version 2.0 (the "License"); #...
StarcoderdataPython
11369484
""" Find primitive tag values that can be converted to comments, and convert them. """ # Set dryRun to False if you want to actually import the comments. dryRun = True from collections import defaultdict from datetime import datetime import time from fluiddb.application import setConfig, setupConfig from fluiddb.dat...
StarcoderdataPython
6474216
# -*- coding: utf-8 -*- try: import clr for f in LoadedDlls: flocation = f.Location clr.AddReferenceToFileAndPath(flocation) from System.Threading import Thread from System.Diagnostics import * from System.Windows.Interop import * from Pinvoke import * except Exception: print ...
StarcoderdataPython
98693
<filename>pytglib/api/types/storage_statistics_by_file_type.py<gh_stars>1-10 from ..utils import Object class StorageStatisticsByFileType(Object): """ Contains the storage usage statistics for a specific file type Attributes: ID (:obj:`str`): ``StorageStatisticsByFileType`` Args: ...
StarcoderdataPython
11268622
import collections from supriya import CalculationRate from supriya.synthdefs import UGen class TExpRand(UGen): """ A triggered exponential random number generator. :: >>> trigger = supriya.ugens.Impulse.ar() >>> t_exp_rand = supriya.ugens.TExpRand.ar( ... minimum=-1., ...
StarcoderdataPython
1940762
<filename>tests/hagan_2002_lognormal_sabr/conftest.py import pytest import itertools import pandas as pd # Path to vols, premiums and discount factors data PATH = 'pysabr/examples/' # Load vols data df_vols = pd.read_csv(PATH + 'vols.csv') df_vols.set_index(['Type', 'Option_expiry'], inplace=True) df_vols.sort_index...
StarcoderdataPython
11390966
<reponame>Wyv3rn-The-H4x0r/Buffer-Overflow-PoC # Wyv3rn # Buffer-Overflow-Exploit # V-1.0 # USAGE : python3 exploit.py "ip of target" import sys import socket hostname = sys.argv[1] password = "<PASSWORD>" # jmp esp found at : # Buffer size : # ------- The Exploit : ---- shellcode = (" ") jmpe...
StarcoderdataPython
6563594
<filename>rlpyt/samplers/serial/sampler.py from rlpyt.samplers.base import BaseSampler from rlpyt.samplers.buffer import build_samples_buffer from rlpyt.utils.logging import logger from rlpyt.samplers.parallel.cpu.collectors import CpuResetCollector from rlpyt.samplers.serial.collectors import SerialEvalCollector from...
StarcoderdataPython
9682766
# Copyright ClusterHQ Inc. See LICENSE file for details. """ Helpers for using libcloud. """ import socket from time import sleep from zope.interface import implementer from characteristic import attributes, Attribute from twisted.internet.defer import DeferredList, maybeDeferred from twisted.python.reflect import...
StarcoderdataPython
6416625
<reponame>chrisba11/kickstarter_projects from django.apps import AppConfig class ProjectsDataAppConfig(AppConfig): name = 'project_data_app'
StarcoderdataPython
8166474
<gh_stars>0 import numpy as np def averageData(data, nsamples=10): """ Downsample the data by averaging ``nsamples``. Args: data (`pandas.DataFrame`): data to average nsamples (`int`): number of samples to average Returns: :class:`pandas.DataFrame` """ group = data.g...
StarcoderdataPython
11221873
<filename>typescript/commands/base_command.py import sublime_plugin from ..libs.view_helpers import is_typescript, active_view class TypeScriptBaseTextCommand(sublime_plugin.TextCommand): def is_enabled(self): return is_typescript(self.view) class TypeScriptBaseWindowCommand(sublime_plugin.WindowCommand...
StarcoderdataPython
1799173
<gh_stars>1-10 # # setup.py : pyvoro python interface to voro++ # # this extension to voro++ is released under the original modified BSD license # and constitutes an Extension to the original project. # # Copyright (c) <NAME> 2012 # contact: <<EMAIL>> or <<EMAIL>> # from distutils.core import setup, Extension from C...
StarcoderdataPython
9754989
# -*- coding: utf-8 -*- import os import shutil import uuid from unittest.mock import patch from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase, override_settings from filebrowser.models import Directory from loader import loader, models from .utils import co...
StarcoderdataPython
3353614
#!/usr/local/bin/python3 """ This script was created by <NAME>. This script is the Lambda function which: • Extracts relevant details from the SQS messages • Uses image names extracted to call AWS Rekognition PPE Detection to analyze the images with exact names in the S3 Bucket ...
StarcoderdataPython
1859980
import numpy as np from skimage import draw import gym import pygame class EnvWrapper(gym.Env): def __init__(self, env, debug, args): self.wrapped_env = env self.metadata = env.metadata self.made_screen = False self.debug = debug self.scaling = args.render_scaling ...
StarcoderdataPython
1887542
class Solution(object): def numberOfLines(self, widths, s): """ :type widths: List[int] :type s: str :rtype: List[int] """ # Runtime: 16 ms # Memory: 13.6 MB line_count = 1 width_used = 0 for char in s: char_len = widths[ord...
StarcoderdataPython
8128262
<gh_stars>10-100 # Copyright 2017 IBM Corporation # Copyright 2017 The Johns Hopkins University # # 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/LICENS...
StarcoderdataPython
161323
<gh_stars>1-10 #!/usr/bin/env python # coding: utf-8 import json, math, copy from geosnap.data import store_ltdb from geosnap.data import Community from geosnap.data import store_census from geosnap.data import data_store import pandas as pd import shapely.wkt import shapely.geometry from datetime import datetime from...
StarcoderdataPython
12843752
<filename>CrudSimulation/forms.py<gh_stars>1-10 from django import forms from django.core.validators import MaxValueValidator, MinValueValidator from .additionals.metaData import * from .models import UserCredentials, UserTasks, UserDepartment from django.contrib.auth.forms import AuthenticationForm class AuthForm(Aut...
StarcoderdataPython
9758442
import configparser import logging import os import re from abc import ABC, abstractmethod from pathlib import Path from typing import List, Union from archiver import helpers CHECK_SEP_STR = '---------------------------------------------------------------' WDIR_REPLACMENT_TAG = '{WDIR}' class SuccessCondition(ABC...
StarcoderdataPython
11254444
<reponame>malneni/cantools # Load and dump a CAN database in SYM format. import collections from itertools import groupby import re import logging from collections import OrderedDict as odict from decimal import Decimal from typing import Callable, Iterator, List, Optional as TypingOptional import textparser from tex...
StarcoderdataPython
11298995
<gh_stars>1-10 # type: ignore # This is the first module in my PackingTest repository. Here we have test # implementations according to the ground rules set out in the README. # # This module implements a commmand line parser that reads a logging level if # this module is executed directly. If you need to set the loggi...
StarcoderdataPython
304542
<reponame>jakoborel/scrape_indeed<filename>DataAnalysis/exploreWA.py import pandas as pd df = pd.read_csv("data/Data_Job_WA.csv") print(df.head()) #print(df.describe()) # Print median salary for "data scientist" positions in WA state print("Median Min_Salary: ", df["Min_Salary"].median()) print("Median Max_Salary: "...
StarcoderdataPython
16976
## ### Copyright (C) 2018-2019 Intel Corporation ### ### SPDX-License-Identifier: BSD-3-Clause ### from ....lib import * from ..util import * from .transcoder import TranscoderTest spec = load_test_spec("mpeg2", "transcode") class to_avc(TranscoderTest): @slash.requires(*have_gst_element("msdkh264enc")) @slash.re...
StarcoderdataPython
47146
from flask import render_template, url_for from appname.mailers import Mailer class InviteEmail(Mailer): TEMPLATE = 'email/teams/invite.html' def __init__(self, invite): self.recipient = None self.invite = invite self.recipient_email = invite.invite_email or (invite.user and invite.us...
StarcoderdataPython
1971818
<reponame>pckhoi/datavalid<filename>datavalid/date.py import datetime import pandas as pd from .exceptions import BadConfigError, BadDateError class DateParser(object): """Parse dates from a table. """ def __init__(self, year_column: str or None = None, month_column: str or None = None, day_column: str...
StarcoderdataPython
11239027
import logging import re from datetime import datetime from pathlib import Path from typing import Any, Dict, Generator, Optional, Pattern from urllib.parse import ParseResult, urlparse import scrapy from scrapy import Spider from opennem.schema.network import NetworkNEM from opennem.utils.dates import parse_date PA...
StarcoderdataPython
9773483
#!/usr/bin/python # # Copyright (c) 2018. All rights reserved. # # 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, m...
StarcoderdataPython
5041703
<reponame>alpiepho/Adafruit_CircuitPython_IS31FL3741 # SPDX-FileCopyrightText: <NAME> 2017 for Adafruit Industries, <NAME> # # SPDX-License-Identifier: MIT """ `adafruit_is31fl3741.adafruit_rgbmatrixqt` ==================================================== CircuitPython driver for the Adafruit IS31FL3741 RGB Matrix QT...
StarcoderdataPython
9711575
# Copyright (c) <2016> <<NAME>>. 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 applicable law or a...
StarcoderdataPython
6579604
<filename>components/ewh_cloud/__init__.py import esphome.config_validation as cv import esphome.codegen as cg from esphome.core import CORE from .. import ewh from esphome.const import CONF_ID CODEOWNERS = ["@dentra"] AUTO_LOAD = ["async_tcp", "text_sensor", "ewh"] CONF_MAC = "mac" CONF_UID = "uid" CONF_HOST = "host...
StarcoderdataPython
11253781
#repaso a = int(input("Ingrese un numero ")) b = int(input("ingrese otro numero ")) c = a + b if c < 10: print('Su numero es menor que 10 ') elif c > 10: print('Su numero es mayor que 10 ') elif c == 10: print('Su numero es 10 ') print('Su numero es: ', c) input('Pulse enter para continuar...') ...
StarcoderdataPython
239605
import factory # NOQA F401 from database import models # NOQA F401 # Insert Factory Boy factories here. Remember that if it escalates, # you may create a factories folder with an __init__ importing all # the factories 😜
StarcoderdataPython
11302306
import torch import torch.nn as nn import torch.nn.functional as F class CondintionNetwork(nn.Module): def __init__(self, n_layers, field, condnet_channels, kernelsize, dropout): super(CondintionNetwork, self).__init__() self.conv_layers = nn.ModuleList([]) self.LeakyReLU = nn.LeakyReLU() ...
StarcoderdataPython