id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3235089 | <gh_stars>0
from flask import Flask
from flask import request
import MySQLdb
import json
import barcode
import db
app = Flask(__name__)
# Application routes determine the functions to call when the user tries to access a particular URL
@app.route('/')
def server_init():
return 'You have reached the home of the STA... | StarcoderdataPython |
127689 | <gh_stars>0
from django.db import models
from django.template import Template, Context
try:
from django.urls import reverse
except:
from django.core.urlresolvers import reverse
def admin_change_url_name(model):
return 'admin:{0}_{1}_change'.format(
model._meta.app_label, model._meta.model_name... | StarcoderdataPython |
3203626 | <gh_stars>0
import os
import secrets
basedir = os.path.abspath((os.path.dirname(__name__)))
class Config(object):
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or "postgresql://postgres:password@db:5432/postgres"
SQLALCHEMY_TRACK_MODIFICATIONS = False
REGISTERS_API_KEY = os.environ.get('REGIST... | StarcoderdataPython |
180301 | <reponame>inspiredideas/lxa5
# -*- encoding: utf8 -*-
import os
import linguistica as lxa
from linguistica.datasets import brown as corpus_path
data_dir = os.path.join(os.path.dirname(__file__), 'data')
def test_stems_to_signatures():
lxa_object = lxa.read_corpus(corpus_path, max_word_tokens=50000)
test_ob... | StarcoderdataPython |
1703112 | import json
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.forms import fields, ValidationError
from puzzle_captcha.models import Puzzle
from puzzle_captcha.widgets import PuzzleCaptchaInput
class PuzzleCaptchaField(fields.Field):
widget = PuzzleCaptchaInput
... | StarcoderdataPython |
1751299 |
bow = []
def make_bag(new_item=None):
global bow
new_item_list = []
if new_item is not None:
if isinstance(new_item, list):
new_item_list = new_item
if isinstance(new_item, str):
new_item_list = [x for x in new_item.split()]
for item in new_item_list:
f... | StarcoderdataPython |
3364770 | <filename>app/main.py
from typing import List
from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from pydantic import BaseSettings, BaseModel
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.exceptions import HTTPException as StarletteHTTPException
from pydantic im... | StarcoderdataPython |
24215 | from bitmovin_api_sdk.encoding.infrastructure.kubernetes.configuration.configuration_api import ConfigurationApi
| StarcoderdataPython |
3265455 | # -*- coding: utf-8 -*-
"""Command to export a single workflow."""
import shutil
from django.core.management.base import BaseCommand
from ontask import models
from ontask.workflow import services
class Command(BaseCommand):
"""Command to export a single workflow."""
def add_arguments(self, parser):
... | StarcoderdataPython |
1770252 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Editor Switcher manager.
"""
# Standard library imports
import os.path as osp
# Third party imports
from qtpy.QtGui import QIcon
# Local imports
from spyder.co... | StarcoderdataPython |
13677 | # grappelli
GRAPPELLI_ADMIN_TITLE = 'pangolin - Administration panel'
# rest framework
# REST_FRAMEWORK = {
# 'PAGINATE_BY_PARAM': 'limit',
# 'SEARCH_PARAM': 'q'
# }
| StarcoderdataPython |
35488 | #!/usr/bin/env python
import numpy as np
import chainer
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
d... | StarcoderdataPython |
3325209 | <gh_stars>0
"""rbldap entrypoint"""
from mailmanclient import Client
from . import __author__, __doc__, __version__
from .accounts.clients import LDAPConnection
from .cli_parser import Program
from .commands import (
add,
alert_unpaid,
delete_unpaid,
disable,
disable_unpaid,
enable,
free,
... | StarcoderdataPython |
3371357 | """Importing this module is deprecated. You should import directly
from :mod:`lino.modlib.printing.mixins` or
:mod:`lino.modlib.printing.choicelists`.
"""
from lino.modlib.printing.mixins import *
| StarcoderdataPython |
178387 | # Testcases covering all information
GET_RELATIONSHIP Arit Brother-In-Law
GET_RELATIONSHIP Yodhan Maternal-Aunt
GET_RELATIONSHIP Laki Maternal-Uncle
GET_RELATIONSHIP Dritha SIBLINGS
GET_RELATIONSHIP Ahit Paternal-Uncle
GET_RELATIONSHIP Ahit Paternal-Aunt
GET_RELATIONSHIP Atya Sister-In-Law
GET_RELATIONSHIP Arit Son
GET... | StarcoderdataPython |
10490 | <filename>elateridae_baits.py
# coding: utf8
"""
Ortholog Based Bait Design Script for creating Elateridae ortholog based baits suitable submission to myBaits
Compares t_coffee AA alignment scores with nucleotide tranalignments to find conserved blocks
Author <NAME> <EMAIL>
License: MIT
Copywright: Government of Canada... | StarcoderdataPython |
3256046 | from eth_account import Account
from rich.console import Console
from config.singletons import env_config
from helpers.discord import get_discord_url, send_message_to_discord
from helpers.enums import BotType, Network
from rewards.aws.helpers import get_secret
from rewards.aws.trees import download_latest_tree, upload... | StarcoderdataPython |
3240656 | # Author: <NAME>
# Module: Emerging Technologies
# Date: September, 2017
# Problem Sheet: https://emerging-technologies.github.io/problems/python-fundamentals.html
# Newton's method for square roots
import math # Importing math functions from python documentation
# create a function to find the square root
def sqrt(... | StarcoderdataPython |
3374062 | import gym
import numpy as np
from gym import wrappers
import pickle
import matplotlib.pyplot as plt
theta_space = np.linspace(-1, 1, 10)
theta_dot_space = np.linspace(-5, 5, 10)
def get_state(observation):
cos_theta1, sin_theta1, cos_theta2, sin_theta2, theta1_dot, theta2_dot = observation
c_th1 = int(np.di... | StarcoderdataPython |
32430 | from typing import Any
from typing import Generic
from typing import overload
from typing import Type
from typing import TypeVar
from . import compat
if compat.py38:
from typing import Literal
from typing import Protocol
from typing import TypedDict
else:
from typing_extensions import Literal # noqa
... | StarcoderdataPython |
1718038 | <reponame>riverlane/deltasimulator
from .__about__ import (
__license__,
__copyright__,
__url__,
__contributors__,
__version__,
__doc__
)
__all__ = [
"__license__",
"__copyright__",
"__url__",
"__contributors__",
"__version__",
"__doc__"
]
| StarcoderdataPython |
180750 | <gh_stars>1-10
import astropy.units as u
from astrotk.bodies.constants import *
# Redefining the definition of AU from 149597870.7 to 149597870.66 for course AE4878 verification.
u.AU = u.def_unit('AU', course_constants["AU"]["val"] * eval(course_constants["AU"]["unit"]))
# Standard BaseClass structure for a point ... | StarcoderdataPython |
3343781 | # -*- coding: utf-8 -*-
from os import path, listdir, mkdir
import numpy as np
np.random.seed(1)
import random
random.seed(1)
import timeit
import cv2
from skimage.color import label2rgb
from tqdm import tqdm
from multiprocessing import Pool
import multiprocessing
import lightgbm as lgb
from train_classifi... | StarcoderdataPython |
3222518 | <filename>BootCRUDApp/views.py
from django.shortcuts import render, redirect, get_object_or_404
from .forms import ItemForm, ItemModel
# Create your views here.
# pulls all objects from the model
def index(request):
item_list = ItemModel.objects.all()
context = {'item_list':item_list}
return render(reque... | StarcoderdataPython |
1732774 | <filename>unittests/test_ts.py
import unittest
import ifm_contrib as ifm
class TestTs(unittest.TestCase):
def test_info(self):
ifm.forceLicense("Viewer")
doc = ifm.loadDocument("./models/example_2D.fem")
doc.c.ts.info()
def test_points(self):
ifm.forceLicense("Viewer")
... | StarcoderdataPython |
38811 | #The code is published under MIT license.
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import cross_validation
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import ro... | StarcoderdataPython |
1635735 | """
simple BTree database. See: https://docs.micropython.org/en/latest/library/btree.html
The ``btree`` module implements a simple key-value database using external
storage (disk files, or in general case, a random-access `stream`). Keys are
stored sorted in the database, and besides efficient retrieval by a key
value... | StarcoderdataPython |
1763415 | from os import environ
import uvicorn
from invoke import task
@task
def test(ctx):
"""Run the tests."""
ctx.run("python -m pytest")
@task
def dev(ctx, port=8000):
"""Runs the API locally on given port.
:param invoke.Context ctx: The invoke context.
:param int port: The port to run the API on, ... | StarcoderdataPython |
186773 | <filename>make/makeUtils/fileSystemUtils.py
import sys
import os
'''
Returns the base of the whole repository structure. From there you can make easy path concatenation.
'''
def getWorkspaceBaseFolder():
pathOfThisScriptFile = os.path.abspath(__file__)
workSpaceFolderPath = os.path.abspath(os.path.join... | StarcoderdataPython |
124020 | <gh_stars>0
################################################################################
# #
# ____ _ #
# | _ \ ___ __| |_ __ _ _ _ __ ___ ... | StarcoderdataPython |
3205714 | import numpy as np
from blockmatrix import SpatioTemporalData
from blockmatrix.utils import get_example_raw
raw, nch, ntim = get_example_raw()
std = SpatioTemporalData(raw)
conds = []
stm = std.get_global_scm()
conds.append(np.linalg.cond(stm.mat))
stm2 = std.swap_primeness().get_global_scm()
stm.plot(True)
stm.swap... | StarcoderdataPython |
3384236 | from rest_framework import viewsets, mixins
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Url
import csv
from django.http import HttpResponse, HttpResponseRedirect
from .serializers import UrlSerializer
class UrlListViewSet(mixins.ListModelMixin, viewsets.G... | StarcoderdataPython |
77070 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
import pytest
from astropy.coordinates import SkyCoord
import astropy.units as u
from regions import CircleSkyRegion
from ...data i... | StarcoderdataPython |
7256 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""IIIF API for Invenio."""
IIIF_API_PREFIX = '/iiif/'
"""URL prefix to IIIF API."""
III... | StarcoderdataPython |
1734331 | from utils import PullRequest
import json
class MockPullRequest(PullRequest):
def __init__(self, labels_json_file):
super(MockPullRequest, self).__init__()
with open(labels_json_file) as f:
self.labels_json = json.load(f)
@property
def labels(self):
return self.labels_j... | StarcoderdataPython |
5466 | <gh_stars>0
"""
Your module description
"""
"""
this is my second py code
for my second lecture
"""
#print ('hello world') # this is a single line commment
# this is my second line comment
#print(type("123."))
#print ("Hello World".upper())
#print("Hello World".lower())
#print("hello" + "world" + ".")
#print(2... | StarcoderdataPython |
56949 | <reponame>manasye/Quick_Hull<gh_stars>1-10
import random
import time
import math
import matplotlib.pyplot as plt
list_of_hull = []
# Function to calculate determinant of three given points
# Equation gathered from Rinaldi's Munir slide -> Penyelesaian Persoalan Convex Hull dengan Divide and Conquer (Quick Hul... | StarcoderdataPython |
151254 | <filename>figures/sKCSD_paper/run_LFP.py
from __future__ import division, print_function
import numpy as np
import sys
import os
import random
import LFPy
from kcsd import sample_data_path
import neuron
morphology_directory = os.path.join(sample_data_path,'morphology')
"""Electrode grid is 2D. If z is the zero dimenti... | StarcoderdataPython |
199084 | from .base import PipBaseRecipe
class CChardetRecipe(PipBaseRecipe):
def __init__(self, *args, **kwargs):
super(CChardetRecipe, self).__init__(*args, **kwargs)
self.sha256 = '9c9269208b9f8d7446dbd970f6544ce4' \
'8104096efab0f769ee5918066ba1ee7e'
self.name = 'cchardet... | StarcoderdataPython |
182209 | <filename>Task2/linkedbst.py
"""
File: linkedbst.py
Author: <NAME>
"""
from abstractcollection import AbstractCollection
from bstnode import BSTNode
from linkedstack import LinkedStack
from linkedqueue import LinkedQueue
from math import log
import time
from random import sample, choice
class LinkedBST(AbstractColle... | StarcoderdataPython |
3200235 | <reponame>aseefahmed/circulation<gh_stars>0
from api.authenticator import BasicAuthenticationProvider
from core.util.http import RemoteIntegrationException
class MockExplodingAuthenticationProvider(BasicAuthenticationProvider):
def __init__(
self,
library,
integration,
analytics=No... | StarcoderdataPython |
3388367 | #!/usr/bin/env python
import argparse
import sys
import networkx as nx
import re
import numpy as np
import itertools
_s = re.compile('\s+')
_p = re.compile('(\d+)\s+(\d+)')
_rings_str = """* place dummy atoms at the center of each rings
*
set ncycles = %s
read sequence POL @NCYCLES
generate DUM warn
%s
scalar wmai... | StarcoderdataPython |
1704464 | import pytest
from parameterized import parameterized
from api.saml.metadata.filter import SAMLSubjectFilter, SAMLSubjectFilterError
from api.saml.metadata.model import (
SAMLAttribute,
SAMLAttributeStatement,
SAMLAttributeType,
SAMLSubject,
)
from core.python_expression_dsl.evaluator import DSLEvaluat... | StarcoderdataPython |
1796230 | import re
class Account():
"""Client account"""
ID_COUNT = 1
def __init__(self, name, **kwargs):
self.id = self.ID_COUNT
self.name = name
self.__dict__.update(kwargs)
Account.ID_COUNT += 1
def __getitem__(self, key):
return getattr(self, key)
def __str__(... | StarcoderdataPython |
3214452 | <filename>code/quick_scraper/quick_scraper/spiders/quick_scraper.py<gh_stars>100-1000
import scrapy
from bs4 import BeautifulSoup
import sys
import os
import _pickle as pickle
import pandas as pd
from .scrape_with_bs4 import *
import datetime
import os
DATA_DIR = os.path.join(os.getcwd(),'..','..','data')
print(DATA_D... | StarcoderdataPython |
1796998 | <reponame>ankitgc1/django-sozluk-master
from django.contrib import admin, messages as notifications
from django.contrib.admin import DateFieldListFilter
from django.utils.translation import gettext, gettext_lazy as _
from dictionary.models import GeneralReport
@admin.register(GeneralReport)
class GeneralReportAdmin(... | StarcoderdataPython |
3264158 | <gh_stars>10-100
from email.utils import formatdate
from jinja2 import Environment, PackageLoader
import logging
from multiprocessing import Pool
import os
from . import __version__
from .cache import cached_storage
from .crawler.get_downloadable_talks import get_downloadable_talks
from .crawler.get_supported_subtitle_... | StarcoderdataPython |
132439 | <filename>2019/08.py
W = 25
H = 6
with open("input.txt") as fin:
file = fin.read().strip()
layers = []
for i in range(0, len(file), W * H):
layer = []
for j in range(i, i + W * H, W):
layer.append(file[j: j + W])
layers.append(layer)
def p1():
zeros = float("inf")
... | StarcoderdataPython |
3315620 | <gh_stars>1-10
"""
Plot temperature comparisons between SIT and SIC modeling experiments using
WACCM4. Subplot includes FIT, HIT, CIT, FIC, FICT
Notes
-----
Author : <NAME>
Date : 13 August 2017
"""
### Import modules
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basem... | StarcoderdataPython |
3261560 | <filename>perceiver/feedforward.py
import tensorflow as tf
from .geglu import GEGLU
class FeedForward(tf.keras.layers.Layer):
def __init__(self, dim, mult=4, dropout=0.0):
super(FeedForward, self).__init__()
self.net = tf.keras.Sequential(
[
tf.keras.layers.Dense(dim * ... | StarcoderdataPython |
1670169 | <gh_stars>1-10
from django.shortcuts import render
from django.views.generic import DetailView
from .models import Page
def home(request):
return render(request, "public_home.html")
class PageView(DetailView):
model = Page
template_name = 'page.html' | StarcoderdataPython |
194828 | # CortexSuite benchmark definitions.
from datatypes import *
from params import *
disparity = Benchmark("disparity", "disparity/src/c")
disparity.set_kernels(
["computeSAD",
"integralImage2D2D",
"finalSAD",
"findDisparity"])
# computeSAD
disparity.set_main_id(0x1f0)
disparity.add_loop("computeSAD",... | StarcoderdataPython |
3233808 | import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from itertools import chain
from pyspark.sql.functions import create_map, lit
from awsglue.dynamicframe import DynamicFram... | StarcoderdataPython |
194096 | <reponame>JasonDu1993/PytorchToCaffe<filename>analysis/PytorchA.py
from __future__ import absolute_import
import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
from collections import OrderedDict
from .layers import *
from . import save_csv
tracked_layers = []
blob_dict = []
layer_n... | StarcoderdataPython |
1648162 | <gh_stars>0
from nose.tools import raises, assert_equal, with_setup
import platform
from distribute.wl import whetlab_make_next_jobs_func
def test_whetlab_make_next_jobs_func():
class Worker_Like():
def __init__(self):
pass
def get_running(self):
return ["1234"]
class Re... | StarcoderdataPython |
3205373 | <reponame>eilonshi/tevel-segmentation
__version__ = '0.0.4.8'
| StarcoderdataPython |
15994 | <filename>ethgasstation.py<gh_stars>10-100
#!/usr/bin/env python3
"""
ETH Gas Station
Primary backend.
"""
import argparse
from egs.main import master_control
from egs.output import Output
def main():
"""Parse command line options."""
parser = argparse.ArgumentParser(description="An adaptive gas price... | StarcoderdataPython |
3299090 | from udapter.predictors.udify_predictor import UdifyPredictor
| StarcoderdataPython |
199656 | # Copyright 2017, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
1711050 | <reponame>soumyajyotih/masci-tools<gh_stars>0
# -*- coding: utf-8 -*-
"""
A simple script that checks the consistency between the version number specified in
setup.json, and the version in the __init__.py file.
"""
import json
import os
import re
import sys
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT... | StarcoderdataPython |
3266178 | from rdkit import Chem
from rdkit.Chem import QED
import numpy as np
import networkx as nx
from openchem.utils.sa_score import sascorer
from rdkit.Chem import Descriptors
def reward_penalized_log_p(smiles, return_mean=True):
"""
Reward that consists of log p penalized by SA and # long cycles,
as described... | StarcoderdataPython |
21296 | import threading
import traceback
import socketserver
import struct
import time
import sys
import http.client
import json
import uuid
import config
import dns.rdatatype
import dns.rdataclass
args = config.args
QTYPES = {1:'A', 15: 'MX', 6: 'SOA'}
custom_mx = uuid.uuid4().hex
# https://github.com/shuque/pydig GNUv2... | StarcoderdataPython |
100290 | <gh_stars>1-10
import unittest
from tests.web_testing_base import TestClientMixin, WasAnalysedCatcher
class TestAnalyseWeb(unittest.TestCase, TestClientMixin):
def setUp(self):
self._setup_testclient()
self._setup_logged_in()
def test_press_analyse_music_button(self):
self._auth_ser... | StarcoderdataPython |
1663128 | <filename>lab_4/ex1.py<gh_stars>0
def main():
temp = []
book = []
com = []
while True:
ch = input("Phonebook> ")
com = ch.split()
if "add" in com:
add(com,book,temp)
elif "lookup" in com:
lookup(com,book)
elif "alias" in com:
a... | StarcoderdataPython |
3241659 | <filename>Chapitres/Chapter4.py
import cv2
import numpy as np
# img = np.zeros((512,512))
# colour functionality (3 chanel)
img = np.zeros((512,512,3),np.uint8)
# img[200:300,100:300] = 255,0,0 # blue form cf same technic as
#img[:] = 255,0,0 # blue window
"""
origine = 0,0
up-to = 300,300
color = green
"""
# width... | StarcoderdataPython |
161893 | <filename>migrate.py
from datetime import datetime
import yaml
import csv
import admin
def load():
with open('./import/data.yaml') as f:
import_data = yaml.safe_load(f)
account_id = admin.create_account(import_data['account'])
clients = {}
for client_key, client_details in import_data['clien... | StarcoderdataPython |
33184 | <gh_stars>10-100
import os
import sys
import lightgbm as lgb
import numpy as np
from malware_rl.envs.utils.ember import PEFeatureExtractor
module_path = os.path.split(os.path.abspath(sys.modules[__name__].__file__))[0]
try:
model_path = os.path.join(module_path, "sorel.model")
except ValueError:
print("The ... | StarcoderdataPython |
3286840 | <filename>translate.py
import argparse
import time
import torch
from Models import get_model
from Process import *
import torch.nn.functional as F
from Optim import CosineWithRestarts
from Batch import create_masks
import pdb
import dill as pickle
import argparse
from Models import get_model
from Beam import beam_searc... | StarcoderdataPython |
1727499 | from hybrid_pool_executor.base import ModuleSpec
from hybrid_pool_executor.workers.async_.worker import (
AsyncManager,
AsyncManagerSpec,
AsyncWorker,
AsyncWorkerSpec,
)
MODULE_SPEC = ModuleSpec(
name="async",
manager_class=AsyncManager,
manager_spec_class=AsyncManagerSpec,
worker_class... | StarcoderdataPython |
1662975 | <filename>packages/helper_functions.py
'''
date : 31/03/2020
description : this module is a list of functions used in the workflow
author : <NAME>
contact : <EMAIL>
licence : MIT 2020
'''
# importance
import os
import sys
import shutil
from glob import glob
from shutil import copyfile, copytree
# i... | StarcoderdataPython |
1772211 | """
Some test to make sure the GPU algorithms return the same answers
as the CPU algorithms
"""
import pycuda.autoinit
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import numpy as np
import matplotlib.pyplot as plt
import time
import scipy.io as sio
import pkg_resources
import sys
from Alignment.Align... | StarcoderdataPython |
3311651 | from collections import defaultdict
import logging
from zope.interface import implements
from twisted.internet import defer
from twisted.python.failure import Failure
from lbrynet.conf import MAX_BLOB_INFOS_TO_REQUEST
from lbrynet.core.client.ClientRequest import ClientRequest, ClientPaidRequest
from lbrynet.lbrylive.L... | StarcoderdataPython |
117975 | <gh_stars>0
from datetime import datetime
class UpTime:
def __init__(self):
self.startDatetime = datetime.now()
def __repr__(self):
return self.__str__()
def current(self):
return (datetime.now() - self.startDatetime).total_seconds()
def __str__(self):
return self.ti... | StarcoderdataPython |
4809066 | import base64
import json
import urllib2
import re
import logging
from github import Github, BadCredentialsException, UnknownObjectException
from github.NamedUser import NamedUser
from django.utils.translation import ugettext as _
from django.conf import settings
from ide.models.user import UserGithub
logger = loggi... | StarcoderdataPython |
3351800 | # -*- coding: utf-8 -*-
# @Author: perfectus
# @Date: 2018-06-27 20:00:24
# @Last Modified by: sumansaurabh
# @Last Modified time: 2018-06-29 23:40:33
# words={}
# with open("words.dat") as inp:
# for line in inp:
# word, definition = line.strip("\r\n").split("\t", 1)
# words[word] = definiti... | StarcoderdataPython |
3283904 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import pickle
from flask import Flask, request
import json
import os
import numpy as np
import tensorflow as tf
from flasgger import Swagger
from time import time
import model, sample, encoder
app = Flask(__name__)
swagger = Swagger(app)
@app.r... | StarcoderdataPython |
1727625 | <reponame>pruty20/100daysofcode-with-python-course<filename>days/01-03-datetimes/code/Challenges/challenges_4_yo.py
"""
You've got the basics down so now create something for yourself!
A fun project would be to create yourself a Pomodoro Timer that incorporates datetime
rather than just the time module. Have it displa... | StarcoderdataPython |
4822405 | class Solution:
"""
@param nums: a list of integers
@return: return a integer
"""
def findShortestSubArray(self, nums):
# write your code here
dict={}
# find the frequency of every number
for i in range(len(nums)):
if nums[i] not in dict.keys():
... | StarcoderdataPython |
1618864 | from floodsystem.station import inconsistent_typical_range_stations
from floodsystem.stationdata import build_station_list
stations = build_station_list()
a = inconsistent_typical_range_stations(stations)
print(a)
| StarcoderdataPython |
1763823 | """Unit tests for the SonarQube commented-out code collector."""
from .base import SonarQubeTestCase
class SonarQubeCommentedOutCodeTest(SonarQubeTestCase):
"""Unit tests for the SonarQube commented-out code collector."""
METRIC_TYPE = "commented_out_code"
async def test_commented_out_code(self):
... | StarcoderdataPython |
1694762 | from asyncqlio.orm.schema.column import Column
from asyncqlio.orm.schema.table import table_base
from asyncqlio.orm.schema.types import BigInt, Boolean, Integer
Table = table_base()
class Crosspost(Table): # type: ignore
guild_id = Column(BigInt, primary_key=True)
channel_id = Column(BigInt, primary_key=Tru... | StarcoderdataPython |
1653635 | import tensorflow as tf
import numpy as np
#a = np.random.rand(4,2)
#x = tf.placeholder(tf.float64, (4.0,2.0))
tf_b = tf.get_variable('b3454',(1))
tf_loss = tf_b * tf_b + 2
opt = tf.train.AdamOptimizer().minimize(tf_loss,var_list=tf_b)
b = 0.0
with tf.Session() as s:
s.run(tf.global_variables_ini... | StarcoderdataPython |
156987 | # Copyright 2018 Google LLC
#
# 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 law or agreed to in writing, ... | StarcoderdataPython |
1642816 | <gh_stars>0
import os
class Configuration:
COORDINATES = os.environ.get("COORDINATES")
DATABASE_NAME = os.environ.get("DATABASE_NAME")
DATABASE_HOST = os.environ.get("DATABASE_HOST")
DATABASE_PORT = int(os.environ.get("DATABASE_PORT"))
SEARCH_RESULTS_URL = os.environ.get("SEARCH_RESULTS_URL")
... | StarcoderdataPython |
143852 | from types import MappingProxyType
from typing import Any, Union, Mapping, Callable, Optional, Sequence
from scanpy import logging as logg
from dask import delayed
from scipy.ndimage.filters import gaussian_filter as scipy_gf
import numpy as np
import dask.array as da
from skimage.color import rgb2gray
from skimage.... | StarcoderdataPython |
1605710 | <reponame>domwillcode/home-assistant
"""The imap_email_content component."""
| StarcoderdataPython |
1624935 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 9 15:07:50 2021
@author: user15
"""
a = [1, 2, 2, 2, 3, 4, 10]
b = [2, 10]
for i in a:
for j in b:
if j == i:
a.remove(i)
print(a)
| StarcoderdataPython |
1715944 | #!/usr/bin/env python
from .callmolconvertSH import molconvert_call
from .json_to_xml_molconvert import dict_to_xml
from .remove_duplicates_function import remove_duplicates_molconvert | StarcoderdataPython |
4801724 | <reponame>YNedderhoff/cle-dependency-parser
from featmap import give_features, give_distance, give_direction, give_surrounding_information
import codecs
class Arc:
def __init__(self, mode="sparse", head=None, dependent=None, head_form=None, dependent_form=None, head_lemma=None,
dependent_lemma=No... | StarcoderdataPython |
1608848 | """Read a pulsarPostProcess dump into python.
"""
# === Start Python 2/3 compatibility
from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import * # noqa pylint: disable=W0401, W0614
from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614
# ==... | StarcoderdataPython |
128217 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from itsdangerous import TimestampSigner
import config
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
token_signer = TimestampSigner(config.SECRET_KEY)
from app.mod_auth.controller import mod_auth
from app.mod_bucketlists.... | StarcoderdataPython |
3216908 | # MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | StarcoderdataPython |
3319728 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
##
# Copyright (C) <NAME>, 2013-2014
# <EMAIL>
# OpenPGP/GPG key: 0x321E4E2373590E5D
#
# Version: 0.0.8
#
# BTC: 1KvKMVnyYgLxU1HnLQmbWaMpDx3Dz15DVU
# License: BSD
#
# Requirements:
#
# * Python 3.2 or later (developed with Python 3.4.x).
# * Converted from scripts ini... | StarcoderdataPython |
141453 | from fabric.api import *
from fabric.operations import put
from fabric.contrib.files import *
import random
import string
# Custom Code Enigma modules
import common.Utils
# Run a composer command
@task
@roles('app_all')
def composer_command(site_root, composer_command="install", package_to_install=None, install_no_de... | StarcoderdataPython |
1733021 | import torch
from YOLO import config as cfg
from torch import optim
from torch.autograd import Variable
from YOLO_pytorch import yolo_net
from YOLO.pascal_voc import *
class Solver():
def __init__(self, net, data, use_gpu=True):
self.net = net
self.data = data
self.max_iter = cfg.MAX_ITER
... | StarcoderdataPython |
1692509 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
1755799 | """
The MIT License
Copyright (c) 2014- High-Mobility GmbH (https://high-mobility.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights... | StarcoderdataPython |
3361047 | <gh_stars>10-100
from __future__ import annotations
from typing import Optional, List, Tuple, Union, Dict
import ctypes
import operator
import warnings
from dataclasses import dataclass
from functools import reduce
import numpy as np
import torch
from dqc.hamilton.intor.lcintwrap import LibcintWrapper
from dqc.hamilton... | StarcoderdataPython |
27016 | <gh_stars>0
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(GenericOnetimeIncome)
admin.site.register(GenericRecurringIncome)
admin.site.register(GenericOnetimeExpense)
admin.site.register(GenericRecurringExpense)
| StarcoderdataPython |
1665522 | # Generated by Django 3.1.4 on 2020-12-12 17:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0004_auto_20201212_1950'),
]
operations = [
migrations.AddField(
model_name='carpet',
name='i... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.