id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11315400 | import cv2
import os
def start_capture(name):
path = "./data/" + name
num_of_images = 0
detector = cv2.CascadeClassifier("./data/haarcascade_frontalface_default.xml")
try:
os.makedirs(path)
except:
print('Directory Already Created')
vid... | StarcoderdataPython |
9661148 | <gh_stars>0
'''
Created on July 17, 2014
@author: ckd27546 (Based upon LpdFemGuiLiveViewWindow.py)
'''
from data_containers import LpdImageContainer
from lpd.fem.client import LpdFemClient
from PyQt4 import QtCore, QtGui
from utilities import AsyncExecutionThread
import sys, os, time, datetime
import numpy as np
... | StarcoderdataPython |
3356452 | """Place holder for future adapter to allow remote access via ssh tunnel.
See Podman go bindings for more details.
"""
from typing import Any, Mapping, Optional, Union
from urllib.parse import urlparse
from requests.adapters import HTTPAdapter
from requests.packages.urllib3 import HTTPConnectionPool # pylint: disabl... | StarcoderdataPython |
5030061 | <gh_stars>1-10
import os
import json
import torch
import torch.nn.functional as F
import numpy as np
import matplotlib
from scipy.io import wavfile
from matplotlib import pyplot as plt
matplotlib.use("Agg")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def to_device(data, device):
if ... | StarcoderdataPython |
1926736 | <filename>test_dirganize.py<gh_stars>1-10
#!/usr/bin/env python
# pylint: skip-file
import logging
import os
import shutil
import click
import pytest
from dirganize import cli
def create_files(folder, *files):
cwd = os.getcwd()
os.chdir(folder)
for file in files:
with open(file, "w"):
... | StarcoderdataPython |
51249 | #!/usr/bin/python3
import logging
from test_shared import initializeLogs, initializeUartPort, baseOperations
from lib.sim900.smshandler import SimGsmSmsHandler, SimSmsPduCompiler
def printScaPlusPdu(pdu, logger):
# printing SCA+PDU just for debug
d = pdu.compile()
if d is None:
return False
... | StarcoderdataPython |
5054265 | # demo inspired from http://tour.golang.org/#67
from offset import makechan, select, go, run, maintask
def fibonacci(c, quit):
x, y = 0, 1
while True:
ret = select(c.if_send(x), quit.if_recv())
if ret == c.if_send(x):
x, y = y, x+y
elif ret == quit.if_recv():
pr... | StarcoderdataPython |
11365101 | import cv2
import numpy as np
def face_warp(img_src, img_dest, landmarks, landmarks_dest):
original_warp_dict = face_warping(img_src, img_dest, landmarks, landmarks_dest, True)
fake_groundtruth_warp_dict = face_warping(img_src, img_dest, landmarks, landmarks_dest, False)
return {
"original_warp": ... | StarcoderdataPython |
268387 | <filename>main.py<gh_stars>1-10
# -*- coding:utf-8 -*-
import os.path as osp
import torch
import torch.nn.functional as F
import numpy as np
from utils import load_data
from model import CGNN
import argparse
def train(data, model, optimizer):
model.train()
optimizer.zero_grad()
pred = model(data)
los... | StarcoderdataPython |
1638140 | <filename>Pacote Download/Ex039_12_Alistamento_Militar.py
#programa que leia o ano de nascimento de um jovem e informe:
# Se ele ainda vai se alistar no serviço militar
# Se é a hora de se alistar
# Se já passou o tempo do alistamento
# O programa tb deverá mostrar o tempo que falta ou tempo q passou para o alistamento... | StarcoderdataPython |
3281011 | <reponame>researchworking/ScalarEMLP<filename>experiments/scalars_nn.py
import torch.nn as nn
import torch
from torch.utils.data import TensorDataset
import numpy as np
import itertools
def comp_inner_products(x, stype, simplified=True):
"""
INPUT:
N: number of datasets
n: number of particles
dim:... | StarcoderdataPython |
3294048 | <reponame>DploY707/AST_parser<gh_stars>1-10
import networkx as nx
import matplotlib.pyplot as plt
from core.utils import Color
from core.utils import set_string_colored
from core.parser import ConstData
from core.parser import stmtList
from core.parser import actionList
from core.parser import dataList
class ASTGra... | StarcoderdataPython |
200596 | <reponame>oferby/networking-bagpipe
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding: utf-8
# Copyright 2014 Orange
#
# 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.ap... | StarcoderdataPython |
6410037 | import os
from typing import Iterable, Mapping, Optional, Union
import gin
from kblocks.gin_utils.config import fix_bindings, fix_paths
from kblocks.gin_utils.path import enable_relative_includes, enable_variable_expansion
_GIN_SUMMARY = """
# --cwd={cwd}
# --incl_rel={incl_rel}
# --expand_vars={expand_vars}
# ----... | StarcoderdataPython |
11237310 | <filename>tests/unit-tests/test_validations.py
import os
import imp
import sys
import testtools
from mock import patch
from cloudify.mocks import MockCloudifyContext
validate = imp.load_source(
'validate', os.path.join(
os.path.dirname(__file__),
'../../components/manager/scripts/validate.py'))
... | StarcoderdataPython |
92103 | # -*- coding: utf-8 -*-
"""
Blackbird statistics plugins.
This plugin get the items queue for "stats" and
put the items queue for "item".
"""
import blackbird
from blackbird.plugins import base
class ConcreteJob(base.JobBase):
def __init__(self, options, queue=None, stats_queue=None, logger=None):
super... | StarcoderdataPython |
38853 | from nose.tools import eq_
import amo.tests
from addons.models import (Addon, attach_categories, attach_tags,
attach_translations)
from addons.search import extract
class TestExtract(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(T... | StarcoderdataPython |
3299402 | <gh_stars>0
# --------------------------------------------------------------------- #
# Name: "Calculadora de IMC"
# Version: "1.0.0"
# Description: "Realiza o Cálculo de Índice de Massa Corporal (IMC)"
# Author: ThiCremonez
# Language: pt-br
# --------------------------------------------------------------------- #
fr... | StarcoderdataPython |
1933448 | from otree.api import Currency as c, currency_range, expect
from . import pages
from ._builtin import Bot
from .models import Constants
class PlayerBot(Bot):
def play_round(self):
yield pages.Demographics, dict(age=24, gender=0, education=3, student=1, experiments=2, chosen_role=1, religion=0)
| StarcoderdataPython |
9753301 | <gh_stars>1-10
/usr/lib/python2.7/encodings/cp856.py | StarcoderdataPython |
11397050 | <reponame>Munene19/Galleryapp<gh_stars>0
# Generated by Django 3.1.3 on 2020-11-19 21:50
import cloudinary.models
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('pics', '0003_auto_20201116_0529'),
]
operations = [
... | StarcoderdataPython |
1800762 | <filename>vision/google/cloud/vision_v1p2beta1/proto/geometry_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/vision_v1p2beta1/proto/geometry.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descripto... | StarcoderdataPython |
5090136 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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 |
6538882 | # Faça um programa que abra e reproduza o áudio de um arquivo MP3 (em Python).
import pygame
pygame.mixer.init()
pygame.mixer.music.load('desafio021.mp3')
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
continue
| StarcoderdataPython |
11254620 | <filename>WorkInProgress/bin/sendtorifa_v2.py
import requests
import json
import os,time,stat
import os
import csv
import shutil
import zabbix_pbi
import logging
import datetime
# Import de classe personnalisée
import class_toolbox
import class_sendmail
#_____________________________________________________... | StarcoderdataPython |
1926552 | <reponame>eriktews/space-status-indicator
#!/usr/bin/env python
from gevent import monkey; monkey.patch_all()
from geventwebsocket.handler import WebSocketHandler
import gevent
import argparse
import re
import datetime
import time
import logging
from gevent import subprocess
from gevent import Greenlet
import socketi... | StarcoderdataPython |
1852119 | """
this application divides a video into segments when it finds motion specified by thresh value
it works with use of OPENCV to detect motion and uses FFMPEG to create an output file.
"""
import sys
from PyQt5 import QtGui
from PyQt5.QtWidgets import (QMainWindow, QLabel, QLineEdit, QPushButton,
... | StarcoderdataPython |
4976260 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, dim, num_clusters=64):
"""
Args:
dim : int
Dimension of descriptors
num_clusters : int
... | StarcoderdataPython |
1863255 | import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
import csv
import time
import math
import threading
import numpy as np
from picamera import PiCamera
from lib_utils import *
from lib_camera import Camera
from lib_blob import Blob
from lib_fin import Fin
from lib_leds import LEDS
status = ['ho... | StarcoderdataPython |
392836 | import csv
import re
from collections import namedtuple
from datetime import datetime
from decimal import Decimal
from enum import unique
from functools import reduce
from pathlib import Path
from typing import (
Dict,
Iterable,
List,
Mapping,
NamedTuple,
Optional,
Sequence,
Set,
Tup... | StarcoderdataPython |
6610680 | <gh_stars>10-100
#**********************************************************************************************
# Traffic Emulator for Network Services
# Copyright 2020 VMware, Inc
# The BSD-2 license (the "License") set forth below applies to all parts of
# the Traffic Emulator for Network Services project. You may n... | StarcoderdataPython |
3473718 | <reponame>jjaramillo34/fastapi-mongo
from fastapi import APIRouter, Body
from fastapi.encoders import jsonable_encoder
from apps.server.database import (
add_student,
delete_student,
retrieve_student,
retrieve_students,
update_student,
)
from apps.server.models.student import (
ErrorResponseMod... | StarcoderdataPython |
3569181 | <gh_stars>1-10
"""
This is a utility script to output an alphabetised line-by-line
difference comparison of two files.
"""
#!/usr/bin/env python
import re
FILE_1 = 'output.txt'
FILE_2 = 'YAWL.list'
OUTPUT = {}
with open(FILE_1, 'r') as f:
for line in f:
WORD = line.strip().lower().split('/')[0].split... | StarcoderdataPython |
312053 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import sys
# test the python version
major, minor = sys.version_info[0:2]
if (major, minor) < (3,6):
sys.stderr.write('\nPython 3.6 or later is required for this package.\n')
sy... | StarcoderdataPython |
1957628 | from os import listdir, getcwd, system
from os.path import isfile, isdir
from sys import stderr
def convert_ui(*args):
"""
Helper function for PyQt5 package to convert .ui files to .py files.
:param args: names of the .ui files to convert to .py files in the current working directory only.
if no argu... | StarcoderdataPython |
3411337 | <gh_stars>100-1000
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, D... | StarcoderdataPython |
8171260 | <reponame>VChristiaens/spec_fit
#! /usr/bin/env python
"""
Module for simplex or grid search of best fit spectrum in a template library.
"""
__author__ = '<NAME>'
__all__ = ['best_fit_tmp',
'get_chi']
from datetime import datetime
from multiprocessing import cpu_count
import numpy as np
import os
from sci... | StarcoderdataPython |
3539615 | <reponame>spradeepv/dive-into-python<gh_stars>0
n, k = map(int, raw_input().split())
list_a = map(int, raw_input().split())
set_a = set(list_a)
list_b = []
for i in set_a:
list_b.append(i + k)
set_b = set(list_b)
print len(set_a.intersection(set_b))
| StarcoderdataPython |
6403514 | #!/usr/bin/python
# Copyright: (c) 2020, DellEMC
""" Ansible module for managing Filesystem Snapshots on Unity"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'suppo... | StarcoderdataPython |
6683987 | from coffin.template import loader
from django.views.generic import create_update as _create_update
import functools
create_object = functools.partial(_create_update.create_object, template_loader=loader)
update_object = functools.partial(_create_update.update_object, template_loader=loader)
delete_object = functools.... | StarcoderdataPython |
3436924 | import sys
from django.core.management.base import BaseCommand, CommandError
from searcher.models import Person, Contribution, Motion, Question
class Command(BaseCommand):
help = 'Returns the total number of table rows in the DB'
def handle(self, *args, **options):
sys.stdout.write('Counting r... | StarcoderdataPython |
3364018 | <filename>rllib/policy/tests/test_multi_agent_batch.py
import unittest
from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch
from ray.rllib.utils.test_utils import check_same_batch
class TestMultiAgentBatch(unittest.TestCase):
def test_timeslices_non_overlapping_experiences(self):
"""Tes... | StarcoderdataPython |
4948400 | from pygal_maps_world.i18n import COUNTRIES
# 模块已经改了
def get_country_code(country_name):
'''
根据指定的国家,返回两个字母的国别码
'''
for code, name in COUNTRIES.items():
if name == country_name:
return code
# 如果没有找到指定的国家,就返回None
return None | StarcoderdataPython |
3285668 | import llvmlite.binding as llvm
def argsIOrole(kernelname, source, filename=None, arglist=False):
try:
m = llvm.parse_assembly(source)
except RuntimeError: # it is source code, not LLVM IR
if filename is None:
raise ValueError('The filename argument must not be None if source code... | StarcoderdataPython |
298292 | import collections
import io
import numpy as np
import torch
from fastprogress.fastprogress import force_console_behavior
master_bar, progress_bar = force_console_behavior()
def predict_test_data(
cpc, logreg, data, device, config, params, fixed_params=False, task12=True, task3=True
):
def load_task_params(... | StarcoderdataPython |
1661170 | <filename>tools/json_schema_compiler/schema_util.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utilies for the processing of schema python structures.
"""
def StripSchemaNamespace(s):
last_do... | StarcoderdataPython |
3494047 | <reponame>KamilWilczek/Log_app
from django.db import models
class Truck(models.Model):
car_manufacturer = models.CharField(max_length=100)
semitrailer = models.CharField(max_length=100)
capacity = models.CharField(max_length=100)
registration_number = models.CharField(max_length=100, unique=True)
... | StarcoderdataPython |
6675938 | # -- coding: utf-8 --
TEST = False # If True, run in test mode. If False, run in live mode
import os
from os.path import basename
from bookings import app
import settings
from google.appengine.ext import db
from models import Booking
from booking_ref_functions import derive
from email_templates import get_booking_co... | StarcoderdataPython |
1642988 | <gh_stars>1-10
from datetime import datetime, timedelta
from unittest.mock import patch
import pytest
import pytz
from django.core import mail
from django.utils import timezone
from graphql_relay import to_global_id
from occurrences.consts import NOTIFICATION_TYPE_ALL, NOTIFICATION_TYPE_SMS
from occurrences.factories ... | StarcoderdataPython |
9706820 | <filename>memote/suite/cli/reports.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | StarcoderdataPython |
6622474 | import os
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
from encoding import MolecularEncoder
ST1_ENERGY_GAP_MEAN = 0.8486
ST1_ENERGY_GAP_STD = 0.3656
class SSDDataset(Dataset):
"""A dataset class for `Samsung AI Challenge For ... | StarcoderdataPython |
5156088 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 20:24:16 2020
@author: <NAME> & <NAME>
"""
import matplotlib.pyplot as plt
from matplotlib import animation, rc
rc('animation', html='jshtml')
from IPython.display import HTML
#from IPython.display import display, clear_output
import PIL
import z... | StarcoderdataPython |
9711749 | from ..query.Queryable import Queryable
from ..providers import IQueryProvider
from ..visitors.sql import SqlVisitor
class SqliteQueryProvider(IQueryProvider):
def __init__(self, db_provider):
self.__provider = db_provider
self.__visitor = SqlVisitor()
@property
def db_provider(self):
... | StarcoderdataPython |
11221024 | <reponame>fcr--/lecli
"""
Team API module.
"""
import sys
import click
import requests
from tabulate import tabulate
from lecli import api_utils
from lecli import response_utils
def _url(provided_path_parts=()):
"""
Get rest query url of account resource id.
"""
ordered_path_parts = ['management', '... | StarcoderdataPython |
4892523 | # -*- coding: utf-8 -*-
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the retry_stats.py module."""
from __future__ import print_function
from six.moves import StringIO
from ch... | StarcoderdataPython |
11204135 | <reponame>kos-kaggle/pytorch_advanced
"""
第2章SSDで実装した内容をまとめたファイル
"""
# パッケージのimport
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.autograd import Function
import torch.utils.data as data
import torch
import cv2
import numpy as np
import os.path as osp
from itertools impo... | StarcoderdataPython |
131217 | <gh_stars>0
####################################
# MonogusaTools
# v.1.0
# (c)isidourou 2013
####################################
#!BPY
import bpy
import random
from bpy.types import Menu, Panel
bl_info = {
"name": "Monogusa Tools",
"author": "isidourou",
"version": (1, 0),
"blender": (2, 65, 0... | StarcoderdataPython |
3318231 | <gh_stars>1-10
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import constant_init, kaiming_init
from ....core.ops.nonlinearities import HSwish
from ...registry import SPATIAL_TEMPORAL_MODULES
class TRGLayer(nn.Module):
"""Based on TRG network: https://arxiv.org/pdf/1908.09995.pdf
"""
... | StarcoderdataPython |
5160201 | import random
import numpy as np
def average_total_reward(env, max_episodes=100, max_steps=10000000000):
'''
Runs an env object with random actions until either max_episodes or
max_steps is reached. Calculates the average total reward over the
episodes.
Reward is summed across all agents, making ... | StarcoderdataPython |
3458340 | <reponame>glide23/dl
import numpy as np
# Linear Least Squares method implemented in numpy, for *invertible* X matrices only
# input:
# X - a matrix which rows hold our data's samples
# y_true - a vector which cells hold the groundtruth value for each sample
# output:
# the weights vector for each dimension of t... | StarcoderdataPython |
5124272 | from unittest.mock import ANY
import pytest
from moto import mock_ec2, mock_iam, mock_sts
from itertools import islice
from cloudwanderer import URN
from cloudwanderer.aws_interface.models import AWSResourceTypeFilter
from cloudwanderer.exceptions import UnsupportedResourceTypeError, UnsupportedServiceError
from ...p... | StarcoderdataPython |
1666768 | import os
from collections import OrderedDict
import numpy as np
np.set_printoptions(suppress=True)
import matplotlib as mpl
from matplotlib import cm
import matplotlib.pyplot as plt
from time import time
from copy import copy
class designer():
def __init__(self,ff,weight,method='D'):
'''
input:
... | StarcoderdataPython |
6633052 | <filename>src/OrganMatching/views.py<gh_stars>1-10
from django.http import HttpResponse
from django.shortcuts import render, redirect
from OrganMatching.misc import *
from OrganMatching.algo import *
blood_groups = ["A", "B", "AB", "O"]
rhesus_factors = ["+", "-"]
reports = ["Positive", "Negative"]
def index(request... | StarcoderdataPython |
6630565 | """Tests for adapter_filter module.
"""
import logging
import unittest
from catch.filter import adapter_filter as af
from catch.filter import candidate_probes as cp
from catch import genome
from catch import probe
from catch.utils import interval
__author__ = '<NAME> <<EMAIL>>'
class TestAdapterFilter(unittest.Tes... | StarcoderdataPython |
1729057 | <gh_stars>1-10
import numpy as np
from typing import List
class Tuple(object):
__slots__ = ["val", "g", "delta"]
def __init__(self, val, g, delta):
self.val = val
self.g = g
self.delta = delta
def __repr__(self):
return '{}[{},{}]'.format(self.val, self.g, self.delta)
cl... | StarcoderdataPython |
82066 | #
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
8113202 | """
A simple and basic Python 3 https://aoe2.net/ API wrapper for sending `GET requests`.
Available on GitHub (+ documentation): https://github.com/sixP-NaraKa/aoe2net-api-wrapper
Additional data manipulation/extraction from the provided data by this API wrapper has to be done by you, the user.
See https://aoe2.net/... | StarcoderdataPython |
1680827 | <reponame>thewahome/msgraph-cli
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRes... | StarcoderdataPython |
3509943 | # -*- coding: utf-8 -*-
import numpy as np
import copy, pdb
from collections import defaultdict
class Rel(object):
""" reliability class.
In this class, we can evaluate the joints' reliability
according to their behavior( spatio & temporal), kinemetic
( physical) and tacking( Kinect) fea... | StarcoderdataPython |
4999596 | <reponame>ericphanson/arxiv-search
import os
import json
import time
import pickle
import argparse
import dateutil.parser
from dateutil.tz import tzutc
from datetime import datetime, timedelta
from pytz import timezone
import copy
from random import shuffle, randrange, uniform
from flask.json import jsonify
from sqli... | StarcoderdataPython |
42317 | <reponame>GGelatin/TekkenBot
#!/usr/bin/env python3
# Copyright (c) 2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... | StarcoderdataPython |
8018154 | from typing import Any
from cloud.amazon.common.base_service_generated_instance import BaseSGI
from properties_and_methods import CachedProperty
from types_extensions import void, const, list_type, dict_type
class AmazonS3Bucket(BaseSGI):
def __init__(self, bucket_name: str, parent, exception_level: int) -> voi... | StarcoderdataPython |
11282650 | <filename>sumNnos.py
n = int(input())
print((n*(n+1))//2)
| StarcoderdataPython |
3376132 | import warnings
from complexity_considerations_package.binary_layer import BinaryConv2D
import config
if config.tf:
from tensorflow.keras.layers import (GlobalAveragePooling2D, GlobalMaxPooling2D, Dense,
multiply, add, Permute, Conv2D,
... | StarcoderdataPython |
1609497 | import os
import dash
import dash_table
import dash_core_components as dcc
import dash_html_components as html
import dash_daq as daq
import pandas as pd
from dash.dependencies import Input, Output
# reading data for statistic table
df = pd.read_csv('data.csv')
app = dash.Dash(__name__)
# needed because of Heroku d... | StarcoderdataPython |
11314690 | <gh_stars>0
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you ... | StarcoderdataPython |
12853897 | # Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | StarcoderdataPython |
1638979 | import WeiBanAPI
import json
import time # time.sleep延时
import os # 兼容文件系统
import random
tenantCode = '61050002' # 成电ID
def main():
# 显示License
licenseFile = open('.' + os.sep + 'LICENSE', encoding='utf-8')
print(licenseFile.read())
licenseFile.close()
# 登录
# 补打空cookie
cookie = ''
... | StarcoderdataPython |
4928994 | <reponame>saurabh6790/community_erpnext_com
"""
Configuration for docs
Add properties
1. `source_link`
2. `docs_base_url`
3. `context`
"""
source_link = "https://github.com/frappe/community_erpnext_com"
docs_base_url = "https://frappe.github.io/community_erpnext_com"
headline = "Connects service seekers and provider... | StarcoderdataPython |
5135959 | <reponame>lacie-life/YoctoPi
#
# SPDX-License-Identifier: MIT
#
import os
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.runtime.decorator.package import OEHasPackage
class GObjectIntrospectionTest(OERuntimeTestCase):
@OETestDepends(["ssh.SSHTest.... | StarcoderdataPython |
384040 | <reponame>hhhaaahhhaa/s3prl
import os
from s3prl.utility.download import _urls_to_filepaths
from .expert import UpstreamExpert as _UpstreamExpert
def mos_wav2vec2_local(ckpt, *args, **kwargs):
"""
The model from local ckpt
ckpt (str): PATH
"""
assert os.path.isfile(ckpt)
kwargs["upstream"... | StarcoderdataPython |
1666303 | <gh_stars>0
def test_conduit06():
# Conduit_TC_006_Reg
# Kijelentkezés
# Előfeltételek:
# 1- A gazdagép elérhető
# 2- A gazdagépen fut a Conduit
# 3- Chrome Verzió: 91.0.4472.77 (Hivatalos verzió) (64 bites)
# 4- OS: Windows 10
# 5- Bejelentkezett felhasználó: Email: <EMAIL> Password: <... | StarcoderdataPython |
4993433 | <gh_stars>1-10
from django.shortcuts import render
from .models import *
from .Se import *
from django.http import HttpResponse, JsonResponse
from rest_framework.decorators import api_view, permission_classes
from rest_framework.views import APIView
from rest_framework import exceptions
# from SAcore.utils.auth import ... | StarcoderdataPython |
3366255 | <filename>wwwhero/models.py
import random
from random import randint
from datetime import timedelta
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator
from django.db import models, transaction
from django.utils import timezone
from wwwhero.exceptions import LevelUpCooldow... | StarcoderdataPython |
8188104 | import logging
from collections import defaultdict
from typing import List, Set, Tuple
from django.contrib import admin
from django.db.models import QuerySet
from model_garden.models import Dataset, MediaAsset
from model_garden.services import S3Client
from model_garden.services.s3 import DeleteError
from .common im... | StarcoderdataPython |
3286327 | import shutil
import traceback
from celery import group, task
from django.conf import settings
from raster.tiles.const import GLOBAL_MAX_ZOOM_LEVEL, MIN_ZOOMLEVEL_TASK_PARALLEL
from raster.tiles.parser import RasterLayerParser
@task
def create_tiles(rasterlayer_id, zoom, extract_metadata=False):
"""
Create ... | StarcoderdataPython |
11313691 | from fastapi import Depends, Header,File, Body,Query, UploadFile, FastAPI, HTTPException, APIRouter, Request, Response, Form, status, BackgroundTasks
from fastapi.security import OAuth2PasswordRequestForm
from fastapi.encoders import jsonable_encoder
from fastapi_mail import FastMail
from sqlalchemy.orm import Session... | StarcoderdataPython |
8153031 | # SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
from itertools import chain
import pandas
from decisionengine.framework.logicengine.BooleanExpression import BooleanExpression
from decisionengine.framework.logicengine.RuleEngine import RuleEngine
from decisionengine.f... | StarcoderdataPython |
4966511 | # -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2012-2020 iSolver Software Solutions (C) 2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
import math
from psychopy.iohub.constants import EventConstants, EyeTrackerConstants
from psychopy.iohub.de... | StarcoderdataPython |
39317 | import requests
import json
import time
import os
import sys
green = "\x1b[38;2;0;255;0m"
greenish = "\x1b[38;2;93;173;110m"
red = "\x1b[38;2;255;0;0m"
grey = "\x1b[38;2;193;184;192m"
reset = "\033[0m"
clear_line = "\033[0K"
# Maximum repository size in megabytes
MAX_REPO_SIZE = 5
def load_cache():
result = []
... | StarcoderdataPython |
8184302 | <gh_stars>0
from collections import OrderedDict
import einops
import torch
from torch import Tensor
from torch.nn import (
CrossEntropyLoss,
GRU,
Module,
Linear,
Sequential,
Tanh,
)
from torch.optim import Adam
from torch.optim.optimizer import Optimizer
from torchaudio.transforms import MelSpe... | StarcoderdataPython |
1636841 | from concurrent.futures import process
from transformers import pipeline
import re
import torch
class PunctuationModel():
def __init__(self, model = "oliverguhr/fullstop-punctuation-multilang-large") -> None:
if torch.cuda.is_available():
self.pipe = pipeline("ner",model, grouped_entiti... | StarcoderdataPython |
12850064 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... | StarcoderdataPython |
6631100 | <gh_stars>1-10
# Copyright (c) 2011-2014 OpenStack Foundation.
#
# 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 applica... | StarcoderdataPython |
12859456 | <reponame>yingbiaoluo/ocr_pytorch
import os
import cv2
import glob
import logging
import numpy as np
from pathlib import Path
import torch
from torch.autograd import Variable
import torch.distributed as dist
class strLabelConverter(object):
def __init__(self, alphabet_):
"""
字符串标签转换
"""
... | StarcoderdataPython |
8013004 | <reponame>MetricRule/metricrule-agent-python
from unittest import TestCase, main
from metricrule.agent import WSGIMetricsMiddleware
class TestWsgiMiddleware(TestCase):
pass
if __name__ == 'main':
main()
| StarcoderdataPython |
96092 | from views import db
from _config import DATABASE_PATH
import sqlite3
# from datetime import datetime
# migration of tasks table
# with sqlite3.connect(DATABASE_PATH) as conn:
# c = conn.cursor()
# c.execute('ALTER TABLE tasks RENAME TO old_tasks')
# db.create_all()
# c.execute("""SELECT name, due... | StarcoderdataPython |
9707090 | <reponame>tmcclintock/PyDonJuan
from unittest import TestCase
from donjuan import Hallway, SquareCell
class HallwayTest(TestCase):
def setUp(self):
super().setUp()
self.cells = [SquareCell() for _ in range(3)]
def test_smoke(self):
h = Hallway()
assert h is not None
a... | StarcoderdataPython |
8129263 | # -*- coding: utf-8 -*-
"""
Created on Wed May 15 18:25:03 2019
@author: <NAME>
"""
import tweepy
from tweepy import OAuthHandler
#insert Twitter Keys
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_KEY = ''
ACCESS_SECRET = ''
auth = OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET)
auth.set_access_token(... | StarcoderdataPython |
137402 | <filename>src/c3nav/editor/views/changes.py
from itertools import chain
from operator import itemgetter
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import User
from django.core.cache import cache
from django.http import Http404
from django.shortcuts import get_o... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.