id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1700264 | <gh_stars>0
from datetime import datetime, timedelta
from re import U
from flask import Flask, request
from flask.helpers import make_response
import jwt
from sqlalchemy.orm import session
import mainn #импортируйте main, чтобы иметь доступ к vars и методам внутри mainn.py файл
app = mainn.app #создайте var пр... | StarcoderdataPython |
38502 | <filename>ros2_automatic_fuzzer/ros2_fuzzer/service_fuzzer.py<gh_stars>1-10
import sys
import os
sys.path.append("..")
from ros2_fuzzer.fuzzing_utils.type_parser import TypeParser
from ros2_fuzzer.fuzzing_utils.fuzzing_descriptor import FuzzTargetProcessor
from ros2_fuzzer.fuzzing_utils.generate_cpp_file import gener... | StarcoderdataPython |
29059 | # Author: <NAME>, <NAME>, <NAME>
# Date: 2020/11/27
"""Compare the performance of different classifier and train the best model given cross_validate results .
Usage: src/clf_comparison.py <input_file> <input_file1> <output_file> <output_file1>
Options:
<input_file> Path (including filename and file extension) to ... | StarcoderdataPython |
3370611 | <filename>models/discriminator/structure_branch.py
import torch
import torch.nn as nn
from utils.misc import weights_init, spectral_norm
class StructureBranch(nn.Module):
def __init__(self, in_channels=4, use_sigmoid=True, use_spectral_norm=True, init_weights=True):
super(StructureBranch, self).__init__... | StarcoderdataPython |
1770671 | <gh_stars>0
import onnx
import onnxruntime
import cv2
import numpy as np
# load onnx model
onnx_model = onnx.load("DAVE_NVIDIA_1_PGD_v2.onnx")
# chose one img to compare the predict result:
full_image = cv2.imread(
"driving_dataset/" + str(0) + ".jpg")
image = cv2.resize(full_image[-150:], (200, 66)) / 255.0
im... | StarcoderdataPython |
22593 | """
Test the model blocks
"""
import datetime
from django.test import TestCase
from mock import Mock
from django.db.models import Model, IntegerField, DateTimeField, CharField
from django.template import Context, Template, TemplateSyntaxError
from example_project.pepulator_factory.models import Pepulator, Distribut... | StarcoderdataPython |
3243827 | <reponame>stormi/tsunami
# -*-coding:Utf-8 -*
# Copyright (c) 2012 <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 copyright no... | StarcoderdataPython |
140700 | from __future__ import absolute_import
# import apis into api package
from .admin_api import AdminApi
from .data_api import DataApi
from .dataset_api import DatasetApi
from .element_api import ElementApi
from .invoice_api import InvoiceApi
from .marketplace_api import MarketplaceApi
from .query_api import QueryApi
fro... | StarcoderdataPython |
3356237 | <filename>wordament/puzzle.py
from py_wordament_helper.wordament_helper import wordament_helper
from py_wordament_helper.dictionary_trie import dictionary_trie
from state_manager_factory import state_manager_factory
from connexion import NoContent
import logging
logger = logging.getLogger('wordament.rest.puzzle')
def... | StarcoderdataPython |
3269892 | import numpy as np
import re
import torch
from common import get_args
from matplotlib import pyplot as plt
from matplotlib.widgets import Slider, Button
from tqdm import tqdm
from vae.import_vae import import_vae
from vae.multicamvae import EncodeConcatVae
from vae.utils import tensor_to_np, device
"""
This is a progr... | StarcoderdataPython |
142110 | <filename>app.py
# Copyright 2019 AstroLab Software
# Author: <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 ... | StarcoderdataPython |
4842818 | # Copyright 2019-20 Near Space Labs
#
# 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 wri... | StarcoderdataPython |
4800754 | from django.test import TestCase, SimpleTestCase
from django.contrib.auth import get_user_model
# Create your tests here.
class DashboardTests(TestCase):
def setup(self):
self.user = get_user_model().objects.create_superuser( email='<EMAIL>',
password='<PASSWORD>',
first_name='tes... | StarcoderdataPython |
3302815 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from click.testing import CliRunner
from disterminal import cli
@pytest.fixture
def runner():
return CliRunner()
def test_cli_no_args(runner):
"""Test the CLI."""
result = runner.invoke(cli.main)
assert result.exit_code == 2
def test_cli_h... | StarcoderdataPython |
3233595 | import pathlib
from xmlapigen.config_generator import ConfigGenerator
if __name__ == '__main__':
here = str(pathlib.Path(__file__).parent.parent)
data_dir = here + '/test/_data/'
ConfigGenerator(
None,
[
data_dir + 'compound.xsd',
data_dir + 'index.xsd'
]
).generate() | StarcoderdataPython |
90586 | <filename>predict.py<gh_stars>0
import torch
from torchvision import transforms, models
import argparse
import json
from utility import process_image
import argparse
from network import load_checkpoint
from network import predict
from utility import process_image
def get_input_args():
parser = argparse.ArgumentPar... | StarcoderdataPython |
3285681 | <reponame>FabienArcellier/spike-computer-vision-streamlit<filename>lib/debug_layer.py
from typing import Union, Tuple
import cv2
from numpy import ndarray
def bbox(img: ndarray, coord: Tuple[int, int, int, int], color: Tuple[int, int, int]):
"""
display the boundary box arround an object
:param img:
... | StarcoderdataPython |
3332712 | <filename>backend/accounts/throttles.py
from .models import AuditLog
from rest_framework import throttling
class AuditedScopedThrottle(throttling.ScopedRateThrottle):
def throttle_failure(self):
request = self.request._request
AuditLog.objects.create(
action="Wrong Password Throttle",... | StarcoderdataPython |
120474 | <filename>kmc_tf_all3siteLV.py
import pandas as pd
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dropout
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
import sklearn.model_selecti... | StarcoderdataPython |
22095 | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return binarySearch(nums,target,0,len(nums)-1)
def binarySearch(nums, target, low, high):
if (low > high):
return -1
... | StarcoderdataPython |
1663664 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
def get_new_tag(self):
"""Return an unused element tag
Parameters
----------
self : Mesh
an Mesh object
Returns
-------
new_tag: int
a new available element tag
"""
new_tag = 0
for key in self.eleme... | StarcoderdataPython |
3283828 | # Generated by Django 3.1.12 on 2021-08-27 11:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("iaso", "0102_page_type"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL... | StarcoderdataPython |
196455 |
import os
import time
import datetime
import json
import pandas as pd
import numpy as np
from pathlib import Path
from tqdm import tqdm
from typing import List, Optional
class PrepareData:
"""
Limpiar y extraer las series de tiempo de una tabla CSV
+ Asegurar fechas continuas, completar con 0 las n... | StarcoderdataPython |
3383974 | # coding: utf-8
"""
Shutterstock API Reference
The Shutterstock API provides access to Shutterstock's library of media, as well as information about customers' accounts and the contributors that provide the media. # noqa: E501
OpenAPI spec version: 1.0.11
Generated by: https://github.com/swagge... | StarcoderdataPython |
3305933 | <gh_stars>1-10
"""
This module is about computing star kinetic and potential energies. It
uses an algorithm coded and c, accessible by python through Ctypes and
a shared library.
"""
import numpy as np
import ctypes as C
import os
import copy
try:
lib_path=os.path.join( os.environ["STARFIDDLELIB"],"libenergy.so")... | StarcoderdataPython |
1737288 | from panel.api.router.templated import nodeRegister
from panel.config.RootData import RootData
import time
import requests
import threading
class nodeData():
def __init__(self) -> None:
self.nodeList = {}
self.readFile()
self.healthCheckStart()
pass
def healthCheckStart(self):
... | StarcoderdataPython |
136433 | <reponame>NTU-ROSE/fast-reid
# encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
import os
from fastreid.data.datasets import DATASET_REGISTRY
from fastreid.data.datasets.bases import ImageDataset
__all__ = ['AirportALERT', ]
@DATASET_REGISTRY.register()
class AirportALERT(ImageDataset):
"""Airport
... | StarcoderdataPython |
34760 | import re
class AlphabetPosition:
alphabet = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9,
'j': 10,
'k': 11,
'l': 12,
'm': 13,
'n': 14,
'o': 15,
'p': 16,
... | StarcoderdataPython |
192746 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^contact/submit/$', views.contact_add, name='contact_add'),
url(r'^panel/contactform/$', views.contact_show, name='contact_show'),
url(r'^panel/contactform/del/(?P<pk>\d+)/$', views.contact_del, name='contact_del'),
]
| StarcoderdataPython |
3355008 | <gh_stars>0
from argparse import ArgumentParser
class BaseCommand:
def create_parser(self):
parser = ArgumentParser()
self.add_argument(parser=parser)
return parser
def add_argument(self, parser: ArgumentParser):
pass
def run_from_argv(self, prog_name, sub_command, argv)... | StarcoderdataPython |
116523 | <gh_stars>10-100
#!/usr/bin/env python
# This code demonstrates how to register a new public key.
#
# Don't forget to store the returned Installation Token.
# The server public rsa key can always be retrieved as long
# as you have your private key and the token.
from bunq import API
from pprint import pprint
# priva... | StarcoderdataPython |
1789576 | <reponame>tut-tuuut/advent-of-code-shiny-giggle
import re
import unittest
# import django
# import networkx as nx
import utils as u
# from . import utils as u # <3
# PEP8 = bien ! Ultra adopté dans la commu Python
# = signe ++ de qualité
# snake_case fonctions et variables
# CamelCase pour les classes
# autopep8 = ... | StarcoderdataPython |
3240724 | import sys
def process():
input = sys.stdin.readline().strip()
num_inputs =
test_case_count = int(sys.stdin.readline().strip())
for i in range(0,test_case_count):
process()
| StarcoderdataPython |
1762371 | <reponame>ay1011/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python<filename>efficiency9/lesson9.py
def genSubsets_a(L):
if len(L) == 0: return [[]] #list of empty list
subsets_no_extra = genSubsets_a(L[:-1]) # get all subsets without last element
extra = L[-1... | StarcoderdataPython |
3353548 |
from Note import Pitch, Note
from enum import Enum
from utils import parse_num_frac, raiseError
from copy import copy, deepcopy
class ChordType:
def __init__(self, name: str, symbol: str, semitones: tuple):
self.semitones: tuple = semitones
self.type: str = symbol
self.name: str = name
... | StarcoderdataPython |
1779440 | <filename>tests/test_memory_leak.py<gh_stars>1000+
import os
from tempfile import NamedTemporaryFile
from time import sleep, time
import os, psutil
import numpy as np
import pytest
from tqdm import tqdm
from assertpy import assert_that
from torch.utils.data import Dataset
from ffcv.writer import DatasetWriter
from f... | StarcoderdataPython |
1712773 | <reponame>collective/Products.PloneGetPaid<filename>Products/PloneGetPaid/generations/r20.py
"""
migrate store settings from annotations to persistent utility.
install new addressbook utility
"""
from Products.PloneGetPaid.Extensions.install import setup_settings, setup_addressbook
from Products.PloneGetPaid import p... | StarcoderdataPython |
3220486 | <reponame>femellone/mock-repo
#!/usr/bin/python3
import random
class Generator:
def __init__(self):
pass
def random_string(self, length=10):
return ''.join([chr(int(random.random() * (ord('z') - ord('a'))) + ord('a')) for c in range(length)])
def random_phrase(self, length=10, word_len... | StarcoderdataPython |
3210 | <gh_stars>0
import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, input_nc, ndf=64, norm_layer=nn.BatchNorm2d, use_sigmoid=False) :
super(Discriminator, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(input_nc, ndf, kernel_size=4, stride=2, padding=1),
nn.Le... | StarcoderdataPython |
47035 | """
Likelihood maximization script. This program is designed to be entirely separable from ATESA in that it can be called
manually to perform likelihood maximization to user specifications and with arbitrary input files; however, it is
required by ATESA's aimless shooting information error convergence criterion.
"""
i... | StarcoderdataPython |
48819 | # Copyright (c) 2015-2019 The Switch Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0, which is in the LICENSE file.
"""
Defines generation projects build-outs.
INPUT FILE FORMAT
Import data describing project builds. The following files are
expected in the input directory.
g... | StarcoderdataPython |
8850 | <filename>owscapable/swe/common.py
from __future__ import (absolute_import, division, print_function)
from owscapable.util import nspath_eval
from owscapable.namespaces import Namespaces
from owscapable.util import testXMLAttribute, testXMLValue, InfiniteDateTime, NegativeInfiniteDateTime
from dateutil import parser
... | StarcoderdataPython |
3211203 | import typing
from pathlib import Path
from UniGrammarRuntime.backends.python.parglare import ParglareParserFactory, toolGitRepo
from UniGrammarRuntime.DSLMetadata import DSLMetadata
from UniGrammarRuntime.grammarClasses import GLR, LR
from UniGrammarRuntime.ParserBundle import InMemoryGrammarResources
from UniGrammar... | StarcoderdataPython |
3309620 | #!/usr/bin/env python
import pytest
"""
Test 1872. Stone Game VIII
"""
@pytest.fixture(scope="session")
def init_variables_1872():
from src.leetcode_1872_stone_game_viii import Solution
solution = Solution()
def _init_variables_1872():
return solution
yield _init_variables_1872
class Te... | StarcoderdataPython |
3358868 | <reponame>piyush1301/plotly.py
import os
PLOTLY_DIR = os.environ.get("PLOTLY_DIR",
os.path.join(os.path.expanduser("~"), ".plotly"))
TEST_FILE = os.path.join(PLOTLY_DIR, ".permission_test")
def _permissions():
try:
if not os.path.exists(PLOTLY_DIR):
try:
... | StarcoderdataPython |
3249777 | <filename>stattools/smoothing/polynomial.py
"""Fit a polynomial curve through a scatterplot."""
import itertools
import numpy as np
from .smoothing import ScatterplotSmoother
from ..glm.linear import LinearRegression
from ..utils.validation import validate_samples, validate_int
class PolynomialSmoother(LinearRegre... | StarcoderdataPython |
73938 | import pytest
import shaderlab
from helper import *
@pytest.fixture
def basic_shader():
data = read_text_data("basic.shader")
return shaderlab.parse(data)
@pytest.fixture
def uber_shader():
data = read_text_data("uber.shader")
return shaderlab.parse(data)
@pytest.fixture
def stripped_shader():
data = read_te... | StarcoderdataPython |
70257 | # Generated by Django 3.0.6 on 2020-05-15 14:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Position',
fields=[
... | StarcoderdataPython |
1677587 | <gh_stars>0
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from pathlib import PurePosixPath
from typing import List
from lisa.executable import Tool
from lisa.operating_system import SLES, Debian, Redhat
from lisa.tools import Echo, Firewall
from lisa.tools.service import Service
from lisa.... | StarcoderdataPython |
3399388 | <reponame>SteveParadox/EcommerceApi
import datetime
from flask import *
from flask_bcrypt import Bcrypt
from flask_jwt_extended import JWTManager
from flask_mail import Mail
from flask_marshmallow import Marshmallow
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
from Backend.config ... | StarcoderdataPython |
3251493 | """Parent directory source for Denite."""
from pathlib import Path
from denite.base.source import Base
from denite.util import abspath
class Source(Base):
"""Gather parent directories of the cwd or input directory."""
def __init__(self, vim):
super().__init__(vim)
self.name = 'parent_dirs'
... | StarcoderdataPython |
1646078 | <filename>recipes/python/django-rest-framework/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/tests/api/test_user.py
import pytest
from django.contrib.auth import get_user_model
from django_dynamic_fixture import G
from {{ cookiecutter.project_slug }}.tests.fixtures import api_client # noqa: F401
from {... | StarcoderdataPython |
3297238 | from __future__ import absolute_import, print_function, division
import os
import unittest
import sys
from numpy.testing.nosetester import NoseTester
# This class contains code adapted from NumPy,
# numpy/testing/nosetester.py,
# Copyright (c) 2005-2011, NumPy Developers
class TheanoNoseTester(NoseTester):
"""
... | StarcoderdataPython |
134246 | import networkx as nx
from entity.entity import Graph, Node
from node2vec import Node2Vec
import numpy as np
from gensim.models.word2vec import Word2Vec
from flask import current_app
from sklearn.decomposition import PCA
from sklearn import manifold
from algorithm.search_community import PyLouvain
from algorithm.simila... | StarcoderdataPython |
86511 | from stests.chain import set_deploy
from stests.chain.utils import execute_cli
from stests.chain.utils import DeployDispatchInfo
from stests.events import EventType
# Method upon client to be invoked.
_CLIENT_METHOD = "put-deploy"
# Name of smart contract to dispatch & invoke.
_CONTRACT_FNAME = "withdraw_bid.wasm"
... | StarcoderdataPython |
1737520 | <gh_stars>1-10
from distutils.core import setup
setup(
name='torroute',
version="0.0.1",
description='Delicate Tornado Route Decorator.',
author='beginman',
author_email='<EMAIL>',
url='https://github.com/BeginMan/torroute',
license='MIT',
packages=['torroute'],
keywords=['tornado', ... | StarcoderdataPython |
140694 | <gh_stars>0
# 콜라츠 추측
```python
def solution(num):
answer = 0
while num>1:
#1-1
if num%2 == 0:
answer += 1
num = num/2
#1-2
else:
answer += 1
num = (num*3) + 1
if answer >= 500:
return -1
retur... | StarcoderdataPython |
3397055 | <filename>games/migrations/0002_auto_20190222_2014.py
# Generated by Django 2.1.7 on 2019-02-22 20:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('games', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='game... | StarcoderdataPython |
85168 | <gh_stars>0
n = int(input('Digite um número: '))
ns = n+1
na = n-1
print(f'O sucessor de {n} é {ns} e o antecessor é {na}.') | StarcoderdataPython |
76936 | # -*- coding: utf-8 -*-
# @Author: luoling
# @Date: 2019-12-06 10:41:34
# @Last Modified by: luoling
# @Last Modified time: 2019-12-18 17:52:49
import torch
import torch.nn.functional as F
import torch.nn as nn
def cross_entropy2d(input, target, weight=None, reduction='none'):
n, c, h, w = input.size()
n... | StarcoderdataPython |
857 | <reponame>AdamSpannbauer/color_transfer<gh_stars>0
# import the necessary packages
import numpy as np
import cv2
import imutils
def color_transfer(source, target, clip=True, preserve_paper=True):
"""
Transfers the color distribution from the source to the target
image using the mean and standard deviation... | StarcoderdataPython |
1739006 | <reponame>jennifereldiaz/fly-tnbc
##examining genes w/in copy number variants in TCGA breast cancer dataset
#the following tier system was used in previous versions
#final system for group assignment is as described in the manuscript
##have p-values for pairwise comparison with RNA expression
##percentage of TN tumo... | StarcoderdataPython |
199050 | <reponame>mysky528/flask-gentelella<gh_stars>0
from os import remove
from os.path import abspath, dirname, join, pardir
from pytest import fixture
import sys
path_test = dirname(abspath(__file__))
path_parent = abspath(join(path_test, pardir))
path_app = join(path_parent, 'source')
if path_app not in sys.path:
sys... | StarcoderdataPython |
3227338 | <filename>headers/forwarded.py
from headers.static_values import *
from worker import *
from utils import *
import requests
class Forwarded():
def __init__(self, destination):
self.destination = destination
self.mime_types = MimeTypes.get_mime_list()
self.payloads = P... | StarcoderdataPython |
1700564 | <filename>tensorflow/python/compiler/mlir/mlir_test.py
# Copyright 2019 The TensorFlow 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.... | StarcoderdataPython |
23303 | <reponame>PuffyPuffin/LO_user<gh_stars>0
"""
Test of the cancellation of terms in the calculation of
tidal energy flux.
This will follow Mofjeld's notation.
F is proportional to the energy flux of the original signal, and
FF is proportional to the sum of the energy fluxes of the incident and
reflected waves.
RESULT:... | StarcoderdataPython |
81452 | <filename>detectron2/distiller_zoo/PKT.py
from __future__ import print_function
import torch
import torch.nn as nn
class PKT(nn.Module):
"""Probabilistic Knowledge Transfer for deep representation learning
Code from author: https://github.com/passalis/probabilistic_kt"""
def __init__(self):
super... | StarcoderdataPython |
42507 | <gh_stars>10-100
from setuptools import setup, find_packages
setup(
name='labelmodels',
version='0.0.1',
url='https://github.com/BatsResearch/labelmodels.git',
author='<NAME>, <NAME>',
author_email='<EMAIL>, <EMAIL>',
description='Lightweight implementations of generative label models for '
... | StarcoderdataPython |
1677062 | <reponame>johnaparker/Qpost<filename>qpost/__init__.py
"""
Qpost
=======
Qpost description
"""
#main submodules
from . import monitors
from . import objects
from . import sources
from . import materials
from . import vec
from . import viz
| StarcoderdataPython |
3219182 | class Solution:
def projectionArea(self, grid: List[List[int]]) -> int:
topProject = 0
frontProject = 0
sideProject = 0
for i in range(len(grid)):
maxXProj = 0
maxYProj = 0
for j in range(len(grid[0])):
if grid[i][j] != 0:
... | StarcoderdataPython |
1742681 | """
Forum polls URLs
================
This module defines URL patterns associated with the django-machina's ``forum_polls``
application.
"""
from django.conf.urls import url
from machina.core.loading import get_class
from machina.core.urls import URLPatternsFactory
class ForumPollsURLPatternsFacto... | StarcoderdataPython |
3345111 | # Python
# Django
# Try Django
# Getting Started (Level 1)
# Challenge 03 - Refactor the existing URL Dispatchers
from django.conf.urls import include, url
from django.contrib import admin
from main import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('main.urls')), # empty path, a... | StarcoderdataPython |
3283889 | import sys,sce
class PrimalItemArmor_TropeSaddle(sce.Saddles):
pass | StarcoderdataPython |
1756954 | <gh_stars>0
import flask_migrate
import pytest
from alembic.script import ScriptDirectory
from flask import current_app
from spammish.database import db, get_current_revision
def test_healthz_liveness(client):
"""Test the /healthz/live check endpoint"""
response = client.get("/healthz/live")
assert respo... | StarcoderdataPython |
3239502 | from django.conf.urls import url
from . import views
app_name = 'feed'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^user/(?P<pk>[0-9]+)/$', views.profile, name='profile'),
url(r'^user/(?P<pk>[0-9]+)/feed/$', views.index_user, name='index_user'),
url(r'^(?P<pk>[0-9]+)/$', views.D... | StarcoderdataPython |
1761183 | """
Segmentaion Part
Modified from DETR (https://github.com/facebookresearch/detr)
"""
from collections import defaultdict
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from PIL import Image
from einops import rearrange, repeat
try:
... | StarcoderdataPython |
170887 | # -*- coding: utf-8 -*-
import sys
sys.path.append('/notebooks')
import wave
import struct
import glob
import params as par
from scipy import fromstring, int16
import numpy as np
import os.path
from keras.models import Sequential, load_model
from keras.layers import Dense, Flatten, Reshape
from keras.layers.noise impo... | StarcoderdataPython |
1620353 | <gh_stars>0
from .test_create import test_create
from .test_delete import test_delete
from .test_get_all import test_get_all
from .test_get_specific import test_get_specific
from .test_update import test_update
| StarcoderdataPython |
1727034 | from .normalized_env import get_normalized_env
| StarcoderdataPython |
147732 | <filename>component/speed.py
class Speed:
def __init__(self):
self._cache = {}
def get_value(self, entity):
value = 0
if entity in self._cache:
value = self._cache[entity]
return value
def update(self, entity, value):
self._cache[entity] = value
# sp... | StarcoderdataPython |
3292431 | <filename>app/models/result/verification.py
from models import TwizoModel
class Verification(TwizoModel):
def __init__(self):
self.applicationTag = None
self.bodyTemplate = None
self.createdDateTime = None
self.dcs = None
self.issuer = None
self.language = None
... | StarcoderdataPython |
153988 | <filename>dm_hamiltonian_dynamics_suite/multiagent_dynamics/game_dynamics.py
# Copyright 2020 DeepMind Technologies Limited.
#
#
# 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
#
# https://www.... | StarcoderdataPython |
85633 | <gh_stars>1000+
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | StarcoderdataPython |
64563 | <filename>Python/python3_version/klampt/math/symbolic_io.py
from .symbolic import *
from .symbolic import _infix_operators,_prefix_operators,_builtin_functions
from ..io import loader
import json
from json import encoder
import weakref
import sys
VAR_PREFIX = ''
USER_DATA_PREFIX = '$'
NAMED_EXPRESSION_TAG = '#'
NAMED_... | StarcoderdataPython |
79302 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | StarcoderdataPython |
1777080 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 18:30:07 2020
@author: ignacio.garciasanche
"""
"""
Baterias : definimos los Atributos (tanto los parametros inmutables como las variables) y los metodos y estados que las baterias poseen.
Funcion Metodo ' bateria_carga(t,t0) ' : input = i... | StarcoderdataPython |
3225770 | import json
from pathlib import Path
annots_files = Path("D:\\Download\\cocostuff_val\\entity_detector\\train\\annotations\\").glob("*.json")
for ann_file in annots_files:
with open(ann_file, "r") as fp:
annotations : list = json.load(fp)
res = []
for ann in annotations["bboxes"]:
... | StarcoderdataPython |
1618199 | import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import logging
DEFAULT_EMAIL_SUBJECT = 'Pytest Email Report'
DEFAULT_EMAIL_BODY_TPL = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.d... | StarcoderdataPython |
63914 | <gh_stars>1-10
# Generated by Django 3.1.7 on 2021-03-28 19:57
import angalabiri.causes.models
from django.db import migrations
import django_resized.forms
class Migration(migrations.Migration):
dependencies = [
('causes', '0003_auto_20210324_0236'),
]
operations = [
migrations.AlterFie... | StarcoderdataPython |
3391473 | import torch
import torch.multiprocessing as mp
from configs import get_config
from logbook import Logger, StreamHandler
from gathering_mae import GatheringEnv
from gathering_mae.torch_types import TorchTypes
import time
import sys
NAMESPACE = 'test_env'
log = Logger(NAMESPACE)
def play_env(id, cfg, shared_mem, exp_... | StarcoderdataPython |
1776878 | #!/usr/bin/env python
from solidfire.common import ApiVersionExceededError
from tests.base_test import SolidFireBaseTest
class TestApiVersionExceededError(SolidFireBaseTest):
def test_should_map_parameters(self):
version_err = ApiVersionExceededError(7.0, 8.0)
self.assertEquals(version_err.api_v... | StarcoderdataPython |
1633824 | <reponame>Sumitb26/CarND-Behavioral-Cloning-P4<filename>model.py<gh_stars>0
import csv
import cv2
import numpy as np
from keras.models import Sequential
from keras.layers import Flatten, Dense, Lambda, Cropping2D
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from PIL import... | StarcoderdataPython |
1698685 | <reponame>sourcery-ai-bot/factom-core<gh_stars>0
import factom_core.blocks as blocks
from factom_core.blockchains import Blockchain
from factom_core.blockchains.mainnet.constants import MAINNET_NETWORK_ID
from factom_core.blockchains.mainnet.genesis import genesis_factoid_block_bytes
class MainnetBlockchain(Blockchai... | StarcoderdataPython |
23104 | <reponame>megatron0000/ces22-xadrez-web<filename>gmailbox/apps.py
from django.apps import AppConfig
class GmailBoxConfig(AppConfig):
name = 'gmailbox'
| StarcoderdataPython |
135563 | <reponame>Lilgabz/Quantum-Algorithm-Implementations
import unittest
import hypothesis.strategies as st
from hypothesis import given, settings, note
from qiskit import QuantumCircuit
from qiskit import Aer, execute
from qiskit.circuit.library import Barrier, XGate, HGate, CXGate, ZGate, Measure
######################... | StarcoderdataPython |
3238672 | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | StarcoderdataPython |
4824820 | <filename>sdk/python/pulumi_aws/ssm/get_patch_baseline.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
from typing import Union
... | StarcoderdataPython |
140032 | <reponame>gcouti/pypagAI<gh_stars>1-10
# aux pkg imports
import pandas as pd
# scikit imports
from pypagai.experiments.evaluation import make_result_frame
from sklearn.cross_validation import train_test_split
from sklearn.utils import safe_indexing
from sklearn.model_selection import KFold, StratifiedKFold, RepeatedSt... | StarcoderdataPython |
3249413 | NAMES = ['<NAME>', '<NAME>', '<NAME>',
'<NAME>', '<NAME>', '<NAME>',
'<NAME>', '<NAME>', '<NAME>',
'<NAME>', '<NAME>', '<NAME>', '<NAME>']
def dedup_and_title_case_names(names):
"""Should return a list of title cased names,
each name appears only once"""
final_list = []
f... | StarcoderdataPython |
53424 | # script to test the parallelized gradient / divergence from pymirc
import numpy as np
import pymirc.image_operations as pi
# seed the random generator
np.random.seed(1)
# create a random 3D/4D image
shape = (6,200,190,180)
# create random array and pad with 0s
x = np.pad(np.random.rand(*shape), 1)
# allocate arra... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.