id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6673919 | <reponame>Zadigo/django_template_project<filename>accounts/forms/passwords.py
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.forms.fields import CharField, EmailField
from django.forms.widgets import EmailInput, PasswordInput
from django.utils.translation import gettext_lazy as _
... | StarcoderdataPython |
278218 | import os
import unittest
import numpy as np
from . import semvec_utils as semvec
class TestSemvecUtils(unittest.TestCase):
def setUp(self) -> None:
# These few lines should enable the test setup to find the test data, wherever the test is run from.
this_dir = os.path.dirname(__file__)
sem... | StarcoderdataPython |
6594493 | <filename>utils/q15tofloat.py
arr = raw_input('Enter Q15 vector separated by spaces in hex decimal: ')
arr = arr.split()
for l in arr:
i = int(l,16)
if(i > 0xFFFF):
print l +'\033[91m' +' : Out of range!'
continue
if(i > 32767): #negative
i = i - 0x10000
... | StarcoderdataPython |
9623759 | <gh_stars>0
#!/usr/bin/env python3
import sys
from riley.commands import ListPodcasts, FetchEpisodes, ListEpisodes, Insert, \
DownloadEpisodes, WhereIsConfig, DownloadBest
class ManagementUtility:
subcommands = {
'list': ListEpisodes,
'insert': Insert,
'podcasts': ListPodcasts,
... | StarcoderdataPython |
4924574 | <gh_stars>0
"""Tests for day 10."""
from day_10.solution import (
calculate_syntax_score_of_navigation_subsystem,
calculate_completion_score_of_navigation_subsystem,
)
_TEST_INPUT = """[({(<(())[]>[[{[]{<()<>>
[(()[<>])]({[<{<<[]>>(
{([(<{}[<>[]}>{[]{[(<()>
(((({<>}<{<{<>}{[]{[]{}
[[<[([]))<([[{}[[()]]]
[{[{(... | StarcoderdataPython |
6594588 | <reponame>superisaac/django-mljson-data
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-15 10:44
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
o... | StarcoderdataPython |
6444615 | import pytest
from scout.load.report import load_delivery_report
from scout.exceptions import DataNotFoundError, IntegrityError
def test_load_delivery_report_bad_case_id(adapter):
## GIVEN no cases in database
assert adapter.case_collection.find_one() is None
## WHEN trying to load a report for a case_i... | StarcoderdataPython |
11363564 | # hello world of python
# vrc6 sawtooth volume map (0..15 -> 0..42)
output = open("sawVolumeMap.txt", "w")
output.write(";--------------------------------------------------------------------------------------------\n")
output.write("@sawVolumeMap:\n")
output.write(";----------------------------------------------------... | StarcoderdataPython |
1633313 | def vers():
major = "1"
minor = "0"
release = "0"
pre = "alpha"
version = ''.join([major,".",minor,".",release,":",pre])
return version
| StarcoderdataPython |
8002691 | # -*- coding: utf-8 -*-
from flask import Blueprint
from flask_jwt_extended.exceptions import NoAuthorizationError
from flask_restplus import Api
from jwt import ExpiredSignatureError
from permission import PermissionDeniedException
# cria blueprint para API
api_bp = Blueprint('api', __name__, url_prefix='/api')
# ... | StarcoderdataPython |
3384692 | #
# This software is delivered under the terms of the MIT License
#
# Copyright (c) 2009 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including wi... | StarcoderdataPython |
14330 | <filename>pylinsql/timing.py
import asyncio
import functools
import time
def _log_func_timing(f, args, kw, sec: float):
print("func: %r args: [%r, %r] took: %2.4f sec" % (f.__name__, args, kw, sec))
def timing(f):
"Decorator to log"
if asyncio.iscoroutinefunction(f):
@functools.wraps(f)
... | StarcoderdataPython |
354275 | #!/usr/bin/env python
"""
PySCeS - Python Simulator for Cellular Systems (http://pysces.sourceforge.net)
Copyright (C) 2004-2017 <NAME>, <NAME>, <NAME> all rights reserved,
<NAME> (<EMAIL>)
Triple-J Group for Molecular Cell Physiology
Stellenbosch University, South Africa
Permission to use, modify, and distribute t... | StarcoderdataPython |
3480973 | #! /usr/bin/env python2.7
from itertools import ifilter
class Sequence:
def __init__( self, previous, current, operation ):
self._previous, self._current, self._operation = previous, current, operation
self._threshold = 0
def __iter__( self ):
return self
def __call__(self, thresho... | StarcoderdataPython |
9629500 | import json, os
import numpy as np
from subprocess import call
def make_directory_tree(path_to_make, sep='/'):
"""
Args:
path_to_make (str) - relative path of directory to make
sep (str) - os-dependent path separator
Returns:
None (makes directory of interest)
"... | StarcoderdataPython |
1653726 | A, B = map(int, input().split())
print(A * B - (A + B - 1))
| StarcoderdataPython |
6454810 | import graphene
from .query import Query
from .mutation import Mutation
schema = graphene.Schema(query=Query, mutation=Mutation)
| StarcoderdataPython |
8085848 | <reponame>zmwangx/ncov
#!/usr/bin/env python3
import datetime
import re
import sys
import bs4
from scraper import logger, network_retry, fetch_dom, DataEntry
@network_retry
def get_article(url):
with fetch_dom(url) as dom:
s = bs4.BeautifulSoup(dom, "html.parser")
body = s.select_one("#article-... | StarcoderdataPython |
5128334 | import cscraper, time, os, argparse
path_of_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")
parser = argparse.ArgumentParser(description="Parse sites for contact data - emails and phones.")
parser.add_argument('-q', '--query', help="provide a search query.") # make possible providing multip... | StarcoderdataPython |
3562038 | a=1
b=2
c=3
d=b*b -4*a*c
d=d**0.5
r1=(-b + d)/(2*a)
r2=(-b - d)/(2*a)
print(r1,r2) | StarcoderdataPython |
12860855 | <reponame>iamvukasin/filminds
from abc import ABC, abstractmethod
import tmdbsimple as tmdb
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.utils.decorators import method_decorator
from rest_framework.response import Response
from rest_framework.views import APIVie... | StarcoderdataPython |
6612194 | <filename>createInstaller/mac/createCompiledCode.py<gh_stars>1-10
"""
############ R INSTALL#################
cp -R /Library/Frameworks/R.framework.bak /Applications/Red-R.app/R
find ./ -name *.dylib -or -name *.so -exec install_name_tool -change /Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libgf... | StarcoderdataPython |
1707212 | <gh_stars>1-10
import torch.nn.functional as F
# Default hyperparameters
SEED = 10 # Random seed
NB_EPISODES = 10000 # Max nb of episodes
NB_STEPS = 1000 # Max nb of steps per episodes
UPDATE_EVERY_NB_EPISODE = 4 # Nb of epi... | StarcoderdataPython |
48302 | #!/usr/bin/env python3
import unittest
import os
import sys
import requests
import utils_test
from multiprocessing import Process
import time
sys.path.append(os.path.abspath('engram'))
import engram
class TestRedirect(utils_test.EngramTestCase):
def test_index(self):
"""
Story: Bookmark pages loads.... | StarcoderdataPython |
5187065 | <reponame>arinazorina/PyTeleBot1
# Телеграм-бот v.004
import telebot # pyTelegramBotAPI 4.3.1
from telebot import types
import botGames # бот-игры, файл botGames.py
import menuBot
from menuBot import Menu # в этом модуле есть код, создающий экземпляры классов описывающих моё меню
import DZ # домашнее задание от пе... | StarcoderdataPython |
4988753 | def make_pizza(size, *toppings):
print("\nMaking a "+str(size)+"-inch size with the following toppings:")
for topping in toppings:
print("-"+topping)
| StarcoderdataPython |
6600848 | <reponame>geekygamer1134/myPythonCode
import pyautogui
import time
import speech_recognition as sr
import os
from pydub import AudioSegment
from pydub.silence import split_on_silence
def test():
im1 = pyautogui.screenshot()
pix1 = im1.getpixel((384,216))
pix2 = im1.getpixel((384*2,216*2))
pix3 = im1.get... | StarcoderdataPython |
9644495 | <gh_stars>1-10
# Problem Link :
# Excel-Sheet Link :
# youtube Video Link :
# o(n^2) O(1)
def Two_No_Sum_1(Array_1, Target_sum):
length = len(Array_1)
for i in range(length):
for j in range(length):
if(Array_1[i]+Array_1[j] == Target_sum and i != j):
return Array_1[i], Arr... | StarcoderdataPython |
226866 | <gh_stars>1-10
from bspider.agent import log
from bspider.core.api import BaseService, GetSuccess, PostSuccess, DeleteSuccess, PatchSuccess
from bspider.core import AgentCache
class ProjectService(BaseService):
def __init__(self):
self.cache = AgentCache()
def add_project(self, project_id, name, con... | StarcoderdataPython |
1693732 | # Copyright (c) 2013, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import get_url_to_form,cstr
from frappe.utils import date_diff, add_months, today, getdate, add_days, flt, get_last_day
from frappe.cor... | StarcoderdataPython |
1889939 | <gh_stars>0
from wildq import wildq
def test_usage():
assert wildq.usage() == 0
| StarcoderdataPython |
6698037 | <gh_stars>1-10
# %%
import networkx as nx
# from networkx.algorithms import centrality
from networkx.readwrite import gexf
import pandas as pd
import matplotlib.pyplot as plt
from networkx.drawing import layout
## https://networkx.github.io/documentation/networkx-1.10/reference/generated/networkx.drawing.nx_agraph.gra... | StarcoderdataPython |
11301848 | <filename>turnovertools/fftools.py
#!/usr/bin/env python3
import datetime
from heapq import heappush, heappop
import itertools
import numpy as np
import os
import subprocess
import signal
import sys
import time
from timeit import timeit
import cv2
import ffmpeg
# from skimage.measure import compare_ssim as ssim
from ... | StarcoderdataPython |
4977947 | from ...imports import *
from ... import utils as U
class ZeroShotClassifier():
"""
interface to Zero Shot Topic Classifier
"""
def __init__(self, model_name='facebook/bart-large-mnli', device=None):
"""
ZeroShotClassifier constructor
Args:
model_name(str): name of a... | StarcoderdataPython |
1914185 | # -*- coding: utf-8 -*-
import asyncio
import irc3
from ircb.storeclient import ChannelStore
@irc3.plugin
class IrcbPlugin(object):
def __init__(self, bot):
self.bot = bot
@irc3.event(irc3.rfc.JOIN)
def on_join(self, mask, channel, **kw):
def callback():
yield from ChannelSt... | StarcoderdataPython |
6484942 | import datetime
import logging
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from finorch.utils.job_status import JobStatus
Base = declarative_base()
class Jo... | StarcoderdataPython |
9749813 | # %%
#######################################
def pandasget_dataframe_info(data_frame: pandas.DataFrame):
import pandas
if isinstance(data_frame, pandas.DataFrame):
return data_frame.info()
| StarcoderdataPython |
4873553 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
VERSION = '0.3'
setup(
name='mtda',
version=VERSION,
scripts=['mtda-cli'],
packages=find_packages(exclude=["demos"]),
author='<NAME>',
author_email='<EMAIL>',
maintainer='<NAME>',
maintain... | StarcoderdataPython |
5019043 | from u import *
from modules import AdaptiveEmbedding, ProjectedAdaptiveLogSoftmax
mask_type = torch.uint8 if torch.__version__.startswith('1.1') else torch.bool
class Decoder(nn.Module):
def __init__(self, c):
super(Decoder, self).__init__()
n_embed = c.n_embed
self.ln1 = nn.LayerNorm(n_... | StarcoderdataPython |
3369922 | # Copyright 2022 DeepL SE (https://www.deepl.com)
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE file.
import argparse
import deepl
import logging
import os
import pathlib
import sys
from typing import List
# Program name for integration with click.testing
name = "python -m... | StarcoderdataPython |
11227007 | """Materializing permission
Revision ID: c3a8f8611885
Revises: <PASSWORD>
Create Date: 2016-04-25 08:54:04.303859
"""
# revision identifiers, used by Alembic.
revision = 'c3a8f8611885'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
from caravel import db
from caravel import models
def... | StarcoderdataPython |
286303 | <reponame>mingchen-lab/deeptrio
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 19:32:21 2021
@author: zju
"""
import numpy as np
def preprocess(pair_file, seq_file):
with open(pair_file, 'r') as f:
lines = f.readlines()
proteins_1 = [line.strip().split('\t')[0] ... | StarcoderdataPython |
129764 | <reponame>bdewitte123/velbus-aio
"""
:author: <NAME> <<EMAIL>>
"""
from __future__ import annotations
from velbusaio.command_registry import register_command
from velbusaio.message import Message
COMMAND_CODE = 0xE8
class TempSensorSettingsPart1(Message):
def populate(self, priority, address, rtr, data):
... | StarcoderdataPython |
3479507 | <filename>Procesar KW Explorer Ahref.py
#!/usr/bin/env python
# coding: utf-8
# Author: Jlmarin
# Web: https://jlmarin.eu
import argparse
import sys
import pandas as pd
from nltk import SnowballStemmer
import spacy
import es_core_news_sm
from tqdm import tqdm
from unidecode import unidecode
import glob
import re
pars... | StarcoderdataPython |
9733499 | <filename>setup.py
# --------------------------------------------
# Copyright 2019, <NAME>
# @Author: <NAME>
# @Date: 2019-1-22 13:50:49
# --------------------------------------------
from os import path
from setuptools import setup, find_packages
file_path = path.abspath(path.dirname(__file__))
with open(path.join... | StarcoderdataPython |
5152417 | <reponame>peppelinux/djangosaml2_spid<filename>src/djangosaml2_spid/apps.py
from django.apps import AppConfig
class Djangosaml2SpidConfig(AppConfig):
name = 'djangosaml2_spid'
| StarcoderdataPython |
8044000 | import numpy as _numpy
from fdrtd.plugins.simon.caches.cache import Cache
from fdrtd.plugins.simon.microprotocols.microprotocol import Microprotocol
class MicroprotocolSecureMatrixMultiplication(Microprotocol):
def __init__(self, microservice, properties, myself):
super().__init__(microservice, properti... | StarcoderdataPython |
4922442 | # https://leetcode.com/problems/subdomain-visit-count
class Solution:
def subdomainVisits(self, cpdomains):
dic = {}
for cp in cpdomains:
num, domain = cp.split(" ")
domain_list = domain.split(".")
N = len(domain_list)
for i in range(N):
... | StarcoderdataPython |
1633545 | #!/usr/bin/env python3
"""
This example uses a configuration file in JSON format to
process the events and apply pre-selection cuts to the images
(charge and number of pixels).
An HDF5 file is written with image MC and moment parameters
(e.g. length, width, image amplitude, etc.).
"""
import numpy as np
from tqdm impo... | StarcoderdataPython |
1717117 | <reponame>Yo-main/akingbee.com
class BaseError(Exception):
pass
class NotInitialized(Exception):
pass
class AlreadyInitialized(Exception):
pass
| StarcoderdataPython |
1982843 | # # <NAME>, 2019
# My program reads in a text file and outputs every second line.
# The program takes the filename of the textfile from an argument on the command line.
with open("moby-dick.txt", 'r') as f:
# Opens text file "moby-dick.txt" saved in the pands-problem-set directory, the file is o... | StarcoderdataPython |
11298588 | <reponame>MartinXPN/DIIN-in-Keras<filename>preprocess.py
from __future__ import print_function
import argparse
import io
import json
import os
import numpy as np
from keras.preprocessing.sequence import pad_sequences
from tqdm import tqdm
from util import get_snli_file_path, get_word2vec_file_path, ChunkDataManager
... | StarcoderdataPython |
3215132 | <reponame>dtrizna/speakeasy<gh_stars>100-1000
# Copyright (C) 2021 FireEye, Inc. All Rights Reserved.
import os
import sys
import cmd
import shlex
import fnmatch
import logging
import binascii
import argparse
import traceback
import hexdump
import speakeasy
import speakeasy.winenv.arch as e_arch
from speakeasy.error... | StarcoderdataPython |
6642837 | a = 5.3
b = 0.000000003
print(a)
print(b)
c = 1.0 / 3.0
print(c)
d = 10.0 * 0.5
print(d)
e = 6.0 + 10.5
print(e)
f = 19.6 - 4.3
print(f)
g = 4.3 - 19.6
print(g)
print("4.5" * 0.5) | StarcoderdataPython |
11354459 | <filename>hack/opamps/opamp_spaces.py
import logging
import re
from fonduer.candidates import MentionNgrams
from fonduer.candidates.models.implicit_span_mention import TemporaryImplicitSpanMention
logger = logging.getLogger(__name__)
class MentionNgramsCurrent(MentionNgrams):
def __init__(self, n_max=2, split_t... | StarcoderdataPython |
8009996 | <reponame>totalpunch/TPD-Pete
import subprocess
from .boto import BotoTool
class AWSCliTool(object):
@classmethod
def getRegion(cls, profile):
""" Get AWS region of a profile
"""
# Check if the AWS Cli is available
if cls.hasAWSCli() is False:
# Use boto3
return BotoTool.getRegion(profile)
# Open t... | StarcoderdataPython |
8025285 | import rospy
import smach
import smach_ros
import threading
import time
from apc_msgs.srv import DoSegmentation,DoSegmentationRequest,FillUnfillBinsCollisionModel,FillUnfillBinsCollisionModelRequest
from sensor_msgs.msg import Image
################################################################################
#
# N... | StarcoderdataPython |
6547520 | from pytrends.request import TrendReq
import pandas as pd
from datetime import datetime, timedelta
from Preprocessing.helpers import date_to_datestring
from Preprocessing.base_class import Preprocessor
class Searchtrends(Preprocessor):
def __init__(self, interval, start_time, end_time):
"""
Initi... | StarcoderdataPython |
4915338 | <filename>tests/models/xapi/fields/test_objects.py
"""Tests for the xAPI object fields"""
from hypothesis import given, provisional, settings
from hypothesis import strategies as st
from ralph.models.xapi.navigation.fields.objects import PageObjectField
@settings(max_examples=1)
@given(st.builds(PageObjectField, id... | StarcoderdataPython |
9677715 | from typing import List, Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str... | StarcoderdataPython |
12857526 | <filename>registry/smart_contract/migrations/0009_auto_20180717_1242.py
# Generated by Django 2.0.7 on 2018-07-17 12:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('smart_contract', '0008_useraccept_company'),
]
... | StarcoderdataPython |
5044650 | """
********************************************************************************
compas_ags.diagrams
********************************************************************************
.. currentmodule:: compas_ags.diagrams
Graphs
======
.. autosummary::
:toctree: generated/
FormGraph
Diagrams
========
.... | StarcoderdataPython |
9637379 | from newsblur_web.celeryapp import app
from utils import log as logging
@app.task()
def IndexSubscriptionsForSearch(user_id):
from apps.search.models import MUserSearch
user_search = MUserSearch.get_user(user_id)
user_search.index_subscriptions_for_search()
@app.task()
def IndexSubscriptionsChunkForS... | StarcoderdataPython |
5152654 | <gh_stars>1-10
# Copyright (c) 2020 Cisco and/or its affiliates.
#
# This software is licensed to you under the terms of the Cisco Sample
# Code License, Version 1.1 (the "License"). You may obtain a copy of the
# License at
#
# https://developer.cisco.com/docs/licenses
#
# All use of the material herein... | StarcoderdataPython |
5109445 | import xml.etree.ElementTree as ET
from programy.parser.template.nodes.base import TemplateNode
from programy.parser.template.nodes.log import TemplateLogNode
from programytest.parser.template.graph_tests.graph_test_client import TemplateGraphTestClient
class TemplateGraphLogTests(TemplateGraphTestClient):
def... | StarcoderdataPython |
6577243 | """Handle the loading and initialization of game sessions."""
from __future__ import annotations
from typing import Optional
import copy
import lzma
import pickle
import traceback
from PIL import Image # type: ignore
import tcod
from engine import Engine
from game_map import GameWorld
import color
import entity_fac... | StarcoderdataPython |
9697213 | <reponame>natgeosociety/marapp-metrics
"""
Copyright 2018-2020 National Geographic Society
Use of this software does not constitute endorsement by National Geographic
Society (NGS). The NGS name and NGS logo may not be used for any purpose without
written permission from NGS.
Licensed under the Apache Licen... | StarcoderdataPython |
1729750 | <reponame>ForrestPi/FaceProjects
import setuptools
setuptools.setup(
name = "qualityface",
version = "1.0.3",
author = "<NAME>",
author_email = "<EMAIL>",
description="Quality face in Pytorch",
long_description="Quality Face model which decides how suitable of an input face for face recognition... | StarcoderdataPython |
8018518 | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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... | StarcoderdataPython |
9627381 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 13 12:43:34 2019
@author: bendowdell
"""
# =============================================================================
# Part A: House Hunting
# You have graduated from MIT and now have a great job! You move to the San Francisco Bay A... | StarcoderdataPython |
342963 | #!/usr/bin/env python
"""This module contains the PathSet Class.
Working with ISIS can result in a lot of files to keep track of.
The PathSet Class is simply a mutable set that only takes
:class:`pathlib.Path` objects. If you need to keep track of a
bunch of files (typically to delete them after a set of processing
c... | StarcoderdataPython |
8062426 | <gh_stars>1-10
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
import sys
import os
import platform
from glob import glob
from setuptools import setup, find_packages
NAME = "pycopia3-QA"
VERSION = "1.0"
CACHEDIR="/var/cache/pycopia"
ISLINUX = platform.system() == "Linux"
if ISLINUX:
DIS... | StarcoderdataPython |
6565120 | <reponame>mariuslihet/CRM<filename>common/views.py
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.http.response import Http404
from django.contrib.auth import logout, authenticate, login
... | StarcoderdataPython |
9715945 | from machin.model.nets.base import static_module_wrapper as smw
from machin.frame.algorithms.a2c import A2C
from machin.utils.learning_rate import gen_learning_rate_func
from machin.utils.logging import default_logger as logger
from machin.utils.helper_classes import Counter
from machin.utils.conf import Config
from ma... | StarcoderdataPython |
3279083 | import logging
from httpclient.client import Client
from openmanoapi.config import BASE_URL
logger = logging.getLogger(__name__)
class Tenant(object):
""" Class for Tenant API
See more: https://osm.etsi.org/wikipub/index.php/RO_Northbound_Interface#Tenants
"""
def __init__(self):
self.__cli... | StarcoderdataPython |
6401752 | <gh_stars>0
from django.apps import AppConfig
class PathsConfig(AppConfig):
name = 'paths'
| StarcoderdataPython |
1855838 | from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.core.exceptions import ValidationError
from todo.models import Todo
class RegistrationForm(UserCreationForm):
email = forms.EmailField(required=True)
def clean_email(self):... | StarcoderdataPython |
8127815 | from main.models import Societe, Facture, Dossier
from datetime import datetime
def Greetings():
new_societe = Societe(
nom="karlson",
localisation="Douala Cameroon",
active=True,
telephone="654451039",
ville="Douala",
pays="Cameroon",
code_postal="100245",
... | StarcoderdataPython |
330484 | from abc import ABCMeta, abstractmethod
class INoise(metaclass=ABCMeta):
def __init__(self):
raise NotImplementedError("This object is an interface that has no implementation.")
@property
@abstractmethod
def NOISE_LIST(self):
raise NotImplementedError("This object is an interface tha... | StarcoderdataPython |
4801334 | <reponame>GlenDC/threefold-wallet-electron<filename>src/tfchain/polyfill/http.py
def http_get(address, endpoint, headers=None):
request = None
resource = address+endpoint
__pragma__("js", "{}", """
request = new Request(resource, {method: 'GET'});
""")
if isinstance(headers, dict):
for k... | StarcoderdataPython |
1688556 | import torch.nn as nn
from HeadNeRFOptions import BaseOptions
from RenderUtils import ExtractLandMarkPosition, SoftSimpleShader
import torch
import torch.nn.functional as F
import FaceModels
from pytorch3d.structures import Meshes
from pytorch3d.renderer import (
PerspectiveCameras, RasterizationSettings, Textures... | StarcoderdataPython |
4867817 | <reponame>BDAthlon/2017-Triple_Helix-1
# -*- coding: utf-8 -*-
"""Comment models."""
from glyphrepository.database import Column, Model, SurrogatePK, db, reference_col, relationship
class Comment(SurrogatePK, Model):
"""A comment."""
__tablename__ = 'comments'
name = Column(db.String(80), unique=False, n... | StarcoderdataPython |
6704038 | <filename>tests/test_plugin.py<gh_stars>0
import json
import os
import shutil
import subprocess
import unittest
import sys
TAGS = ("python2", "python3")
TESTDIR = "/tmp/test-linuxdeploy-plugin-python"
ROOTDIR = os.path.realpath(os.path.dirname(__file__) + "/..").strip()
_is_python2 = sys.version_info[0] == 2
def ... | StarcoderdataPython |
272860 | from django import forms
from django.contrib import admin
from .models import Attachment, Property, Session, Upload
from .utils import import_class
class AttachmentAdmin (admin.ModelAdmin):
list_display = ('file_path', 'file_name', 'file_size', 'content_type', 'context', 'date_created')
readonly_fields = ('d... | StarcoderdataPython |
12842055 | <filename>TFQ/barren_plateaus/bp_tfq.py
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
import matplotlib.pyplot as plt
# https://www.tensorflow.org/quantum/tutorials/barren_plateaus#2_generating_random_circuits
def generate_circuit(qubits, depth, param):
circui... | StarcoderdataPython |
11283703 | import sys, os
from io import BytesIO
import sympy
from PIL import Image, ImageOps, ImageChops
rootdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
srcdir = os.path.join(rootdir, 'src')
sys.path.insert(0, srcdir)
latexsources = []
import fitfunctions
for name in fitfunctions.__all__:
cls = geta... | StarcoderdataPython |
261569 | #!/usr/bin/env python3
__author__ = 'Zirx'
# -*- coding: utf-8 -*-
from http.cookiejar import CookieJar
from urllib.parse import urlencode, unquote
from urllib.error import URLError
from urllib.request import HTTPCookieProcessor, build_opener, Request
from bs4 import BeautifulSoup
import re
import sys
import xml.dom... | StarcoderdataPython |
108303 | # fortune_docker/users/urls.py
| StarcoderdataPython |
27194 | import torch
from torch import dtype, nn
import torch.nn.functional as F
class PAM_Module(nn.Module):
def __init__(self, num, sizes,mode=None):
super(PAM_Module, self).__init__()
self.sizes = sizes
self.mode = mode
for i in range(num):
setattr(self, "query" + str(i),
... | StarcoderdataPython |
6683321 | import matplotlib as plt
import numpy as np
#I hold x a line while defining new values for each y
x = np.linspace(0, 20, 2000)
#1*x[1] + 0*x[2] <= 5
#y0*0=5-x #No initialization with respect to y0 because it is zero.
#0*x[1] + 1*x[2] <= 5
y1=5+x*0
#1*x[1] + 0*x[2] >= 1
#y2*0=1-x #No inititialization
#0*... | StarcoderdataPython |
151046 | # The isBadVersion API is already defined for you.
# def isBadVersion(version: int) -> int:
class Solution:
def firstBadVersion(self, n: int) -> int:
start, end = 1, n
while start < end:
mid = start + (end - start) // 2
check = isBadVersion(mid)
if check... | StarcoderdataPython |
6575763 | <filename>manager.py
# General Package
import os, sys
from pymongo import settings
# Set the path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
# General Packages
from flask_script import Manager, Server
# User Pacakages
import settings
from application import create_app, create_db, ... | StarcoderdataPython |
12854488 | <gh_stars>0
print("Thank you Jesus")
# Read a value from standard input a value
# input("Thank you")
# Evaluate expression
x = 1
print(x)
x += 3
print(x)
# loops
if x > 1:
print("great than 1")
else:
print("less than 1")
n = 3
while n > 1:
print(n)
n -= 1
# Arithmetic operator
print({100 % 3}, {10... | StarcoderdataPython |
11304437 | <reponame>J03D03/VaRA-Tool-Suite
"""Module for the :class:`BugProvider`."""
import logging
import typing as tp
from benchbuild.project import Project
import varats.provider.bug.bug as bug
from varats.project.project_util import (
get_primary_project_source,
is_git_source,
)
from varats.provider.provider impor... | StarcoderdataPython |
11233588 | ''' from __nonstandard__ import where_clause
shows how one could use `where` as a keyword to introduce a code
block that would be ignored by Python. The idea was to use this as
a _pythonic_ notation as an alternative for the optional type hinting described
in PEP484. **This idea has been rejected; it is included j... | StarcoderdataPython |
289332 | """
Tests for dit.math.sampling.
"""
from __future__ import division
import pytest
import numpy as np
import dit.math.sampling as module
import dit.example_dists
from dit.exceptions import ditException
#sample(dist, size=None, rand=None, prng=None):
def test_sample1():
# Basic sample
d = dit.example_dists.... | StarcoderdataPython |
3576038 | from gui.vlist.vlist import VList | StarcoderdataPython |
3262506 | <gh_stars>10-100
# Copyright 2015 Brocade Communications System, 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 required b... | StarcoderdataPython |
275100 | from globals import *
import alife
import logging
import random
import os
def prettify_string_array(array, max_length):
"""Returns a human readable string from an array of strings."""
_string = ''
_i = 0
for entry in array:
if len(_string) > max_length:
_string += ', and %s more.' % (_i+1)
break
... | StarcoderdataPython |
6586793 | <filename>utils/make_syngcn_data.py<gh_stars>0
import argparse
import spacy
import bisect
from pathlib import Path
from tqdm import tqdm
from file_loader import Fileloader
class Text2format:
def __init__(self, voc2id, id2freq, max_len):
self.did = 0
self.voc2id = voc2id
self.id2freq = id2f... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.