id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
208018 | from django.contrib import admin
from django.urls import path
from django.contrib.auth.views import LoginView
from . import views
app_name = 'users'
urlpatterns = [
# ex /users/
path('', views.index, name='index'),
# ex /users/login/
path('login/', LoginView.as_view(template_name='users/login.html'),... | StarcoderdataPython |
303484 | import sys
def read_input(f):
return [f(line.strip()) for line in sys.stdin.readlines()]
| StarcoderdataPython |
3466246 | from django.apps import AppConfig
class CreatecsvConfig(AppConfig):
name = 'main.csv'
| StarcoderdataPython |
6495150 | # IMPORTS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Third party
from django.contrib import admin
# Internal
from brands.models import Brand
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class BrandAdmin(admin.ModelAdmin):
list_display = ... | StarcoderdataPython |
3526702 | import numpy as np
from matplotlib import pyplot as plt
__all__ = ['Spectrum']
class Spectrum(np.ndarray):
"""
Class representing a 1 dimensional spectrum.
Attributes
----------
freq_axis : `~numpy.ndarray`
one-dimensional array with the frequency values.
"data\\" : `~numpy.ndarray`... | StarcoderdataPython |
1983370 | __________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def isAdditiveNumber(self, num: str) -> bool:
if(num=="19910011992"):
return False
if(len(num)<=2):
return None
def create(check,... | StarcoderdataPython |
6429856 | """
This module provides all functionality related to maintaining the user information for chatter.
"""
import logging
import time
import chatter.dbutil as db
import chatter.twitter as twitter
clog = logging.getLogger(__name__)
LIST_PREFIX = 'chatter'
LIST_SLEEP_TIME = 15
MAX_USERS_PER_LIST = 4999
MAX_USERS_PER_DAY ... | StarcoderdataPython |
1933906 | <reponame>demohack/nonpub<filename>demos/flask-jinja-demo/video-demo/app.py
from flask import Flask, request, render_template
from random import randint, choice, sample
from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config['SECRET_KEY'] = "chickenzarecool21837"
debug = DebugToolbarExt... | StarcoderdataPython |
209521 | <reponame>shaikustin/jc<gh_stars>0
import os
import json
import unittest
import jc.parsers.csv_s
from jc.exceptions import ParseError
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
# To create streaming output use:
# $ cat file.csv | jc --csv-s | jello -c > csv-file-streaming.json
class MyTests(unittest.Tes... | StarcoderdataPython |
5082182 | # Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt
# of any required approvals from the U.S. Dept. of Energy).
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the ... | StarcoderdataPython |
1781481 | <reponame>jiyeonkim127/PSI
import os, sys
import os.path as osp
import cv2
import numpy as np
import json
import yaml
import open3d as o3d
import trimesh
import argparse
import matplotlib.pyplot as plt
sys.path.append('/home/yzhang/workspaces/smpl-env-gen-3d-internal')
import torch
import pickle
import smplx
from hum... | StarcoderdataPython |
9736746 | from __future__ import print_function, division, absolute_import
from struct import pack
from ..message import BulkFrontendMessage
class SslRequest(BulkFrontendMessage):
message_id = None
SSL_REQUEST = 80877103
def read_bytes(self):
bytes_ = pack('!I', self.SSL_REQUEST)
return bytes_
| StarcoderdataPython |
9636196 | def solution(A):
s = set()
for n in A:
s.add(n)
return int(len(s) == max(A) and len(s) == len(A))
| StarcoderdataPython |
1789248 | <gh_stars>100-1000
# Copyright (c) 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... | StarcoderdataPython |
6547040 | from rest_framework import status
from rest_framework.generics import RetrieveAPIView, CreateAPIView, RetrieveUpdateAPIView
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.exceptions import Validat... | StarcoderdataPython |
72513 | <gh_stars>0
from setuptools import setup, find_packages
from pathlib import Path
# get current directory
current_directory = Path(__file__).resolve().parent
def get_long_description():
"""
get long description from README.rst file
"""
with current_directory.joinpath("README.rst").open() as f:
... | StarcoderdataPython |
135329 | <reponame>sergioisidoro/django-flows
from flows.statestore.tests.models import TestModel
def store_state_works(case, store):
test_model = TestModel.objects.create(fruit='apple', count=34)
task_id = '10293847565647382910abdcef1029384756'
state = {'a': 1,
'b': 'cake',
... | StarcoderdataPython |
269667 | import math
import pandas as pd
import os
#iN CASE OF RUNNING IN THE GRANCANNAL DATA
#path=os.path.dirname(os.getcwd())#os.getcwd()
#change = path+'/Grand Canal Docks Dedicated throughput'
#os.chdir(change)
#df_sheet_name = pd.read_excel('30m.xls', sheet_name='Metric Group 1')
files = [f for f in os.listdir('.') if '... | StarcoderdataPython |
1672857 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Coded by: <NAME> <EMAIL>,
# Planified by: <NAME>, <NAME>, <NAME>
# Finance by: Vauxoo.
# Audited by: <NAME> (<EMAIL>) y <NAME> (<EMAIL>)
{
"name": "Mexico - Accounting",
"version": "2.0",
"auth... | StarcoderdataPython |
1814434 | <filename>astromodels/core/model.py
from builtins import zip
__author__ = "giacomov"
import collections
import os
import warnings
import numpy as np
import pandas as pd
import scipy.integrate
from astromodels.core.memoization import use_astromodels_memoization
from astromodels.core.my_yaml import my_yaml
from astro... | StarcoderdataPython |
1705632 | <gh_stars>0
from django import forms
from django.http import Http404
from django.shortcuts import redirect
from django.utils.translation import gettext_lazy as _
from django.views import View
from django.views.generic import TemplateView
from django.views.generic.base import TemplateResponseMixin
from django.views.gene... | StarcoderdataPython |
9605878 | from __future__ import absolute_import
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# Sandesh Connection
#
import os
from builtins import object
from .gen_py.sandesh.constants import SANDESH_CONTROL_HINT
from .gen_py.sandesh.ttypes import SandeshRxDropReason
from .protocol import TXMLProtoc... | StarcoderdataPython |
6510702 | <filename>software/ringledoff.py
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 24)
pixels.fill((0,0,0))
| StarcoderdataPython |
4925034 | <reponame>yarikoptic/metadata-model<filename>tools/metadata_creator/execute.py
import shlex
import subprocess
from typing import Any, List, Optional, Tuple, Union
def execute(arguments: Union[str, List[str]],
stdin_content: Optional[Union[str, bytes]] = None) -> Any:
return subprocess.run(
sh... | StarcoderdataPython |
1621157 | import operator
import json
import unicodecsv as csv
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse
from rest_framework.decorators import api_view
from rest_framework.response import Response
from curricula.models import Curriculum, Unit
from standards.models import *
fro... | StarcoderdataPython |
8166159 | # Generated by Django 2.0.2 on 2018-08-21 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0002_auto_20180821_1337'),
]
operations = [
migrations.AlterField(
model_name='student',
name='bitsId',
... | StarcoderdataPython |
8154931 | import gffutils
import argparse
import os
def split3UTR(UTR3gff, fragsize, outfile):
gff_fn = UTR3gff
print 'Indexing gff...'
db_fn = os.path.abspath(gff_fn) + '.db'
if os.path.isfile(db_fn) == False:
gffutils.create_db(gff_fn, db_fn, merge_strategy = 'merge', verbose = True)
db = gffutils.FeatureDB(db_fn)
pr... | StarcoderdataPython |
1975721 | """
This file contains the fixtures that are reusable by any tests within
this directory. You don't need to import the fixtures as pytest will
discover them automatically. More info here:
https://docs.pytest.org/en/latest/fixture.html
"""
from typing import Any, Dict
import pytest
from kedro.io import AbstractDataSe... | StarcoderdataPython |
3205169 | # ACTIVITY 3: PYTHON NUMBERS
# Program Description: This is a program that takes the user's input to calculate for the employee's gross and net salary.
# The hourly rate is already pre-determined and has been set to 500.
# Additionally, the tax rate is set to 10 percent of the employee's gross income.
hourlyRat... | StarcoderdataPython |
9775632 | # -*- coding: utf-8 -*-
import os.path
from gettext import NullTranslations, translation
translation_dir = os.path.join(
os.path.dirname(
os.path.abspath(
__file__,
),
),
"translations"
)
current_translation = NullTranslations()
def set_locale(locales):
global current_tr... | StarcoderdataPython |
285989 | # Generated by Django 3.0.2 on 2020-02-11 17:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0006_auto_20200211_1625'),
]
operations = [
migrations.AlterField(
model_name='post',
... | StarcoderdataPython |
11280601 | # -*- coding: utf-8 -*-
import time
from pyqtgraph.Qt import QtCore, QtGui, QtTest
def resizeWindow(win, w, h, timeout=2.0):
"""Resize a window and wait until it has the correct size.
This is required for unit testing on some platforms that do not guarantee
immediate response from the windowing syste... | StarcoderdataPython |
5005754 | <reponame>Hwizdaleck/Python
usuario1=input('digite seu usuario')
usuario2='<PASSWORD>'
qtd=len(usuario1)
if (qtd)!=6 or usuario1!=usuario2:
print('senha incorreta')
else:
print('senha correta')
| StarcoderdataPython |
5080301 | # -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : deep-learning-with-python-notebooks
@File : ch0601_raw_text_to_word_embedding.py
@Version : v0.1
@Time :... | StarcoderdataPython |
6690371 | <filename>klusta_process_manager/fileBrowser/fileBrowser.py
import os
#QT
import sip
sip.setapi('QVariant',2)
sip.setapi('QString',2)
from PyQt4 import QtCore,QtGui
from .tableDelegate import TableDelegate
from .folderView import FolderView
#---------------------------------------------------------------------------... | StarcoderdataPython |
9766191 | import unittest
from random import random
from bubble_sort import bubble_sort
class TestBubbleSort(unittest.TestCase):
def setUp(self):
self.unsorted_values = [random() for i in range(20)]
def test_bubble_sort_returns_an_array(self):
sorted_values = bubble_sort(self.unsorted_values)
... | StarcoderdataPython |
6444166 | <gh_stars>1-10
#coding:utf8
import sys,os
import torch as t
from data import get_data
from model import PoetryModel
from torch import nn
from torch.autograd import Variable
from utils import Visualizer
import tqdm
from torchnet import meter
import ipdb
class Config(object):
data_path = 'data/' # 诗歌的文本文件存放路径
... | StarcoderdataPython |
146386 | <gh_stars>1-10
import nmap
# Création de l'objet
scanner = nmap.PortScanner()
# Input & Cast
ip_addr = input("Target IP : ")
type(ip_addr)
# Display Options
resp = input("""\n Options :
1)SYN ACK Scan
2)Comprehensive Scan \n""")
# Scan de port : SYN
if resp == '1':
print("Nmap Vers... | StarcoderdataPython |
3523464 | <filename>research/cv/stgcn/src/model/metric.py
# Copyright 2021 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://www.apache.org/licenses/LICENSE-2.0
#
... | StarcoderdataPython |
6422825 | '''
Test alb template creation, resource creation
and resource functionality for Anchore alb
'''
import os
import unittest
import pytest
from anchore import alb, main
from tests.mocks import schema
class TestALB(unittest.TestCase):
def setUp(self):
self.template = alb.ALBTemplate()
def test_add_descriptions(self... | StarcoderdataPython |
3200226 | <reponame>epoch8/datapipe<filename>tests/test_core_steps2.py<gh_stars>1-10
# Ex test_compute
# from typing import cast
# import pytest
import time
import pandas as pd
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import Integer
from datapipe.store.database import TableStoreDB, MetaKey
from datapipe.data... | StarcoderdataPython |
11391805 | # Generated by Django 2.0.6 on 2018-07-02 10:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelchimp', '0023_machinelearningmodel_epoch_durations'),
]
operations = [
migrations.AddField(
model_name='machinelearningmode... | StarcoderdataPython |
38212 | # ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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, ... | StarcoderdataPython |
9695289 | <filename>src/marmo/report/blueprints/reportitem.py
#
# Generated with ReportItemBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
class ReportItemBlu... | StarcoderdataPython |
11385453 | from typing import cast
from pydantic import ValidationError
from werkzeug.exceptions import InternalServerError
from cibo import Blueprint, ErrorContext
from ..exceptions import AuthException
api = Blueprint("api", __name__, openapi_tag="API", tag_description="description of API")
@api.errorhandler(ValidationErr... | StarcoderdataPython |
3372243 | # Copyright (c) 2021 <NAME>
from pywayland.server import Display, Signal
from wlroots import ffi, PtrHasData, lib
class GammaControlManagerV1(PtrHasData):
def __init__(self, display: Display) -> None:
"""Creates a wlr_gamma_control_manager_v1"""
self._ptr = lib.wlr_gamma_control_manager_v1_creat... | StarcoderdataPython |
6530184 | <filename>Genclass/__init__.py<gh_stars>1-10
name = 'Genclass' | StarcoderdataPython |
5038028 | from chainer.backends import cuda
import cupy
import numpy as np
from chainerkfac.optimizers.cholesky_inverse import inverse
import warnings
PI_TYPE_TRACENORM = 'tracenorm'
def get_diagval(link, attrname, damping):
param = getattr(link, attrname, None)
if param is None:
return
r = getattr(par... | StarcoderdataPython |
5104217 | version = "0.25.0" # pylint:disable=invalid-name
| StarcoderdataPython |
1996495 | <reponame>webkom/committee-admissions
from rest_framework import authentication
class SessionAuthentication(authentication.SessionAuthentication):
"""
This class is needed, because REST Framework's default SessionAuthentication does never return
401's, because they cannot fill the WWW-Authenticate header ... | StarcoderdataPython |
4880638 | <reponame>SafonovMikhail/python_000577<filename>000468BookBRIGG/000468_01_06_01_ex01_for_range_20190528.py
for x in range(0, 5):
print('привет')
input() | StarcoderdataPython |
381448 | import argparse
from glob import glob
from os import path
parser = argparse.ArgumentParser()
parser.add_argument("outfile")
parser.add_argument("directory")
parser.add_argument("--split", "-s", default='.atsp')
args = parser.parse_args()
target = args.outfile
directory = args.directory
split = args.split
files = glo... | StarcoderdataPython |
3467105 | <reponame>dwyer/folklorist<filename>ballads/views.py
import logging
import os
import urllib
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from django.core.paginator import Paginator
from models im... | StarcoderdataPython |
11230820 | <filename>tests/test_NeqSim.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 3 22:24:08 2019
@author: ESOL
"""
from neqsim.neqsimpython import jNeqSim
def test_Viscosity():
thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0, 10.0)
thermoSystem.addComponent("methane", 10.0)
thermoSystem.addComponen... | StarcoderdataPython |
29494 | from django.shortcuts import render
# Python functions - user is going to request an url
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("<h1> This is the music app homepage</h1>") | StarcoderdataPython |
3322627 | #!/usr/bin/env python3
import boto3
from botocore.exceptions import ClientError
# from botocore.errorfactory import BadRequestException
import os
import logging
# logger = logging.getLogger()
services = {
"access-analyzer.amazonaws.com": "IAM Access Analyzer",
# "guardduty.amazonaws.com": "AWS GuardDuty", # ... | StarcoderdataPython |
8018825 | from .Model import Model
from .TransE import TransE
from .TransH import TransH
from .TransD import TransD
from .TransD import TransD
from .TransR import TransR
from .RESCAL import RESCAL
from .DistMult import DistMult
from .HolE import HolE
from .ComplEx import ComplEx
from .Analogy import Analogy
| StarcoderdataPython |
56056 | import socket
print(" _____ _ _____ _ _ ")
print(" | __ \ | | / ____| (_) | ")
print(" | | | | __ _ _ __| |_ _____| (___ ___ ___ _ _ _ __ _| |_ _ _ ")
print(" | | | |/ _` | '__| __|______\___ \ / _ \/ __| | | | '__|... | StarcoderdataPython |
160507 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
from __future__ import unicode_literals
import pip
import pexpect
import os
import re
from behave impo... | StarcoderdataPython |
1636178 | <gh_stars>0
#%% [markdown]
## Conversao de tipos
2 + 3 #Soma
'2' + '3' #Concatenação
# 2 + '3'
a = 2
b = '3'
print(type(a))
print(type(b))
#Convertendo uma string para int
print(a + int(b))
#Convertendo a variável a (tipo int) para string. Resultado: concatenação
print(str(a) + b)
#Resultado: string (resultado da... | StarcoderdataPython |
11330466 | <reponame>f-ilic/tdv<gh_stars>0
import torch
import torch.nn.functional
class TVL2Regularizer(torch.nn.Module): # l2
def __init__(self, *args, **kwargs):
super(TVL2Regularizer, self).__init__()
Kx = torch.Tensor([[0, 0, 0],
[0, -1, 1],
[0, 0, 0]])... | StarcoderdataPython |
5089135 | #!/usr/bin/env python
from __future__ import division
import sys
import json
import requests
from herepy.here_api import HEREApi
from herepy.utils import Utils
from herepy.error import HEREError
from herepy.models import RmeResponse
class RmeApi(HEREApi):
"""A python interface into the RME API"""
def __ini... | StarcoderdataPython |
6469867 | '''
算法: 1. 把所有元素放入哈希表。 2. 遍历哈希表,对每个元素依次值加(减)一,并检查是否在哈希表中。如果存在,移出哈希表。
func longestConsecutive (nums []int) int {
// write your code here
m := make(map[int]bool)
for _, v := range nums {
m[v] = true
}
res, down, up := 1, 0, 0
for k := range m {
for i := k + 1; m[i]; i++ {
up++
delete(m, i)
}
fo... | StarcoderdataPython |
366527 | import nbformat as nbf
import sys
# Collect a list of all notebooks in the content folder
filenames = sys.argv[1:]
text = '# Solution'
replacement = ''
# Search through each notebook
for filename in filenames:
ntbk = nbf.read(filename, nbf.NO_CONVERT)
for cell in ntbk.cells:
# remove tags
if... | StarcoderdataPython |
399255 | from file_1 import *
def target_func(x=func1, y=func2(), z=lambda: func3, w=lambda: func4()):
p1 = lambda: func5()
p2 = lambda: func6
p1(), p2()
def inner(ix=func7, iy=func8(), iz=lambda: func9, iw=lambda: func10()):
func11()
ip = lambda: func12()
ip()
func13()
inner(fu... | StarcoderdataPython |
1771366 | import datetime
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
current = datetime.datetime.now()
renew = current.minute + 3
print(renew)
print(current)
while(True):
current = datetime.datetime.now()
if current.minute == renew:
print("Time to ren... | StarcoderdataPython |
5132614 | <reponame>Marzooq13579/Hack-Gadgets<gh_stars>100-1000
#!/usr/bin/env python
try:
from mechanize import Request, urlopen, URLError, HTTPError,ProxyHandler, build_opener, install_opener, Browser
except ImportError:
print "\n[X] Please install mechanize module:"
print " http://wwwsearch.sourceforge.net/mec... | StarcoderdataPython |
1975196 | <gh_stars>0
# +
import nbformat
import re
class assignment_rubric:
def __init__(self, file):
self.rubric_items = []
self.question_points = {}
self.subquestion_points = {}
self.get_rubric_items(file)
self.get_points()
def get_rubric_items(self, file):
nb ... | StarcoderdataPython |
3482764 | from rest_framework.generics import ListCreateAPIView, RetrieveAPIView
from .serializers import RoomSerializer
from room.models import Room
class RoomListCreateAPIView(ListCreateAPIView):
queryset = Room.objects.all()
serializer_class = RoomSerializer
class RoomRetrieveAPIView(RetrieveAPIView):
queryset ... | StarcoderdataPython |
11253595 | """
Torch argmax policy
"""
import numpy as np
import railrl.torch.pytorch_util as ptu
from railrl.policies.base import SerializablePolicy
from railrl.torch.core import PyTorchModule
import torch
class ArgmaxDiscretePolicy(PyTorchModule, SerializablePolicy):
def __init__(self, qf):
self.save_init_params(l... | StarcoderdataPython |
3342183 | <reponame>zignig/cqparts_bucket<filename>plank.py
" A plank for mounting stuff on "
import cadquery as cq
import cqparts
from cqparts.params import *
from cqparts.constraint import Fixed, Coincident
from cqparts_misc.basic.primatives import Box
from cqparts.display import render_props
from .manufacture import Lasercu... | StarcoderdataPython |
5117742 | from compas.geometry import Frame
from compas.robots import LocalPackageMeshLoader
import compas_fab
from compas_fab.backends.kinematics import AnalyticalInverseKinematics
from compas_fab.backends import PyBulletClient
urdf_filename = compas_fab.get('universal_robot/ur_description/urdf/ur5.urdf')
srdf_filename = comp... | StarcoderdataPython |
23385 | import spidev
columns = [0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8]
LEDOn = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
LEDOff = [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
LEDEmoteSmile = [0x0,0x0,0x24,0x0,0x42,0x3C,0x0,0x0]
LEDEmoteSad = [0x0,0x0,0x24,0x0,0x0,0x3C,0x42,0x0]
LEDEmoteTongue = [0x0,0x0,0x24,0x0,0x42,0x3C,0xC,0x0]
LEDEmoteS... | StarcoderdataPython |
1745983 | import unittest
from unittest import mock
from dataprofiler.labelers import base_model
class TestBaseModel(unittest.TestCase):
@mock.patch('dataprofiler.labelers.base_model.BaseModel.'
'_BaseModel__subclasses',
new_callable=mock.PropertyMock)
def test_register_subclass(self, ... | StarcoderdataPython |
3404617 | from __future__ import unicode_literals
from django.urls import reverse_lazy
from django.views.generic import ListView
from portfolio.views import BaseSudoView
from portfolio.skills.models import Skills
from portfolio.categories.models import Category
from portfolio.skills.forms import SkillsForm
class SkillsFormsV... | StarcoderdataPython |
3284484 | """
Basic wheel tests.
"""
import os
import pkg_resources
import json
import sys
from pkg_resources import resource_filename
import wheel.util
import wheel.tool
from wheel import egg2wheel
from wheel.install import WheelFile
from zipfile import ZipFile
from shutil import rmtree
test_distributions = ("complex-dist"... | StarcoderdataPython |
332666 | <filename>BreakTheName.py<gh_stars>0
#cerner_2tothe5th_2021
# Get all substrings of a given string using slicing of string
# initialize the string
input_string = "floccinaucinihilipilification"
# print the input string
print("The input string is : " + str(input_string))
# Get all substrings of the stri... | StarcoderdataPython |
11233988 | #%%
import pandas as pd
import numpy as np
import holoviews as hv
import hvplot.pandas
from scipy.sparse.linalg import svds
from scipy.stats import chisquare, chi2_contingency
from sklearn.decomposition import TruncatedSVD
from umoja.ca import CA
hv.extension('bokeh')
#%%
X = context.io.load('xente_train')
Y = contex... | StarcoderdataPython |
6426877 | <filename>utils/emulation_host_meta_generator.py
import StringIO
import sys
import os
path = os.path.realpath(__file__)
sys.path.insert(0, '%s/..' % os.path.dirname(os.path.abspath(__file__)))
from ixnetwork.IxnHttp import IxnHttp
def process_node(metadata, class_name):
# build find
expected_states ... | StarcoderdataPython |
9720702 | <gh_stars>0
import os
import sys
import time
import numpy as np
import torch
import torch.distributed as dist
import torch.utils.collect_env
from contextlib import contextmanager
from torch.nn.parallel import DistributedDataParallel
class DDP(DistributedDataParallel):
# Distributed wrapper. Supports asynchronous eval... | StarcoderdataPython |
4947784 | <reponame>idigbio-citsci-hackathon/CsvToolbox<filename>src/anonymizer.py
#!/usr/bin/env python
# Given a CSV file, generates another CSV anonymizing the column specified
# as usernames while maintaining the other columns (quotes around a value
# may vary from the original file). The column ID specification is 0-based.
... | StarcoderdataPython |
4885299 | """initial
Revision ID: 5a2877e096ed
Revises:
Create Date: 2022-03-20 21:22:58.439923
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "5a2877e096ed"
down_revision = None
branch_labels = None
depends_on = None
def upg... | StarcoderdataPython |
9711539 | import os
import subprocess
import threading
import pwd
from django.conf import settings
from django.utils.datetime_safe import datetime
from django.db.models import Q
from hujan_ui.installers.models import Server, Inventory, GlobalConfig, Deployment
from hujan_ui.utils.global_config_writer import GlobalConfigWriter
fr... | StarcoderdataPython |
6637299 | <filename>nnblk/tree.py
import itertools
BLANK = ''
class Tree(object):
def __init__(self, operator, operand):
self.operator = operator
self.operand = operand
self.parent = None
self.children = list()
def add_child(self, child):
child.parent = self
self.childr... | StarcoderdataPython |
368815 | # SecurityGroupCorrector.py || part of ZocSec.SecurityAsCode.AWS
#
# An AWS Lambda for removing security groups that expose sensitive ports to the entire Internet
#
# Owner: Copyright © 2018 Zocdoc Inc. www.zocdoc.com
# Author: <NAME> @veggiespam
#
import boto3
from botocore.exceptions import ClientError
... | StarcoderdataPython |
6474655 | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int16
class seigyo(object):
def __init__(self):
self._pub_control = rospy.Publisher('/control', Int16, queue_size=1)
while(1):
self._ren()
def _ren(self):
print "1: start, 0: prepare"
s = input()
control = Int16()
control.data = s
self._... | StarcoderdataPython |
8192900 | <reponame>reiv/cachelib
import itertools
import pytest
from cachelib import ARCache
def identity(x):
return x
@pytest.fixture
def on_evict():
from collections import Counter
c = Counter()
def callback(key):
c[key] += 1
callback.count = c
return callback
class TestARC:
def test_a... | StarcoderdataPython |
3540065 | # Empty file
from cemc.ce_calculator import CE, get_atoms_with_ce_calc
from cemc.ce_calculator import get_atoms_with_ce_calc_JSON
from cemc.timed_test_logging import TimeLoggingTestRunner
| StarcoderdataPython |
365869 | <filename>py/torch_tensorrt/_util.py
from torch_tensorrt import __version__
from torch_tensorrt import _C
def dump_build_info():
"""Prints build information about the TRTorch distribution to stdout
"""
print(get_build_info())
def get_build_info() -> str:
"""Returns a string containing the build infor... | StarcoderdataPython |
3591860 | <gh_stars>0
print("Day 1 - Python print Function")
print("The Function is declared like this :")
print("print('what to print')") # Practice makes men perfect
# Just like you train your muscle
# The data in Double qoutes "" is called Strings not code
# The single qoutes are almost the same as double qoutes
# The Great... | StarcoderdataPython |
6682899 | response = {
"result": {
"result": {
"order0": {
"ID": "35943",
"TITLE": "7-я Кожуховская ул., 4К1: 104%, 3.6, эт. 12/16, 10.5 -> 16.3 (от собственника)",
},
"order1": {
"ID": "161",
"TITLE": "преображенская ... | StarcoderdataPython |
3496534 | import serial,time
class get_co_data:
def __init__(self, device='/dev/ttyS0', baudrate=9600, timeout=1):
self.ser = serial.Serial(device, baudrate=baudrate, timeout=timeout)
self.ser.flush()
def repeat_get_data(self):
float_values = ['ADC_In', 'Voltage_ADC', 'Resistance_RS', 'Rat... | StarcoderdataPython |
1911938 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 13:45:39 2020
the version of loompy should be the consistent with velocyto; otherwise error returned
@author: jingkui.wang
"""
import loompy
import glob
files = glob.glob("/Volumes/groups/cochella/git_aleks_jingkui/scRNAseq_MS_lineage/data/raw_... | StarcoderdataPython |
335196 | #!/usr/bin/env python3
from itertools import combinations
from hashlib import md5
from numpy import lcm
from collections import defaultdict
from AoCUtils import getInts
COORDS = {'x', 'y', 'z'}
def sumVelToPos(planets):
for p in planets:
for v in COORDS:
p['pos'][v] += p['vel'][v]
def hashP... | StarcoderdataPython |
1671026 | <filename>butterfly/complex_utils.py
''' Utility functions for handling complex tensors: conjugate and complex_mul.
Pytorch (as of 1.0) does not support complex tensors, so we store them as
float tensors where the last dimension is 2 (real and imaginary parts).
'''
import numpy as np
import torch
from torch.utils.dlpa... | StarcoderdataPython |
6400848 | <reponame>kairu-ms/autorest.az
#!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------... | StarcoderdataPython |
1782544 | <gh_stars>10-100
#=========================================================================
# RegincrNstage_test
#=========================================================================
import collections
import pytest
from random import sample
from pymtl import *
from pclib.test import run_test_... | StarcoderdataPython |
11286695 | # Time: O(n) on average
# Space: O(1)
# 973
# We have a list of points on the plane. Find the K closest points to the origin (0, 0).
# (Here, the distance between two points on a plane is the Euclidean distance.)
#
# You may return the answer in any order. The answer is guaranteed to be unique (except for
# the ord... | StarcoderdataPython |
8116995 | <filename>tests/cluster/test_cluster_utlis.py<gh_stars>10-100
from cluster_setup import *
def test_sizes_from_labels():
labels = jnp.array([0, 0, 1, 1, 2, 2])
sizes = cluster.sizes_from_labels_jit(labels, 3)
assert_array_equal(sizes, jnp.array([2, 2, 2]))
def test_start_end_indices():
sizes = jnp.ar... | StarcoderdataPython |
1728898 | <reponame>pulumi/pulumi-rancher2<filename>sdk/python/pulumi_rancher2/registry.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
fr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.