id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8111179 | import os
import sys
from datetime import datetime
from decimal import Decimal
from timeit import timeit
from unittest.case import TestCase
from uuid import UUID, uuid4
from eventsourcing.application import AggregateNotFound, Application
from eventsourcing.persistence import InfrastructureFactory
from eventsourcing.po... | StarcoderdataPython |
8072637 | <reponame>MiningTheDisclosures/conflict-minerals-data
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-07 04:27
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('edgar', '0004_auto_20170706_2035'),
]
... | StarcoderdataPython |
5066364 | <filename>models/python/demo-dataset/15.py
def fibonacci_memo(input_value):
fibonacci_cache = {}
if input_value in fibonacci_cache:
return fibonacci_cache[input_value]
if input_value == 1:
value = 1
elif input_value == 2:
value = 1
elif input_value > 2:
... | StarcoderdataPython |
1824282 | <reponame>stephaniemhutson/BoxPackingAPI
from fulfillment_api.api_verify import verify_box_api
from fulfillment_api.constants import permissions
from .errors import APIError, BoxError
from .messages as msg
from ..authentication.login_required import (login_required,
shotput... | StarcoderdataPython |
3256622 | from collections import defaultdict
from itertools import count
from operator import itemgetter
from pathlib import Path
from typing import Dict, Optional
from typing import List, Tuple, Union
import htbuilder
import streamlit as st
from htbuilder import span, div, script, style, link, styles, HtmlElement, br
from htb... | StarcoderdataPython |
6616355 |
#
# https://stackoverflow.com/a/47706195/1832058
#
import requests
import re
from bs4 import BeautifulSoup
# Create a variable with the url
url = 'https://www.ncbi.nlm.nih.gov/protein/EGW15053.1?report=fasta'
# Use requests to get the contents
r = requests.get(url)
# Get the text of the contents
html_content = r.t... | StarcoderdataPython |
3422097 | """Process reporting of tests or test steps."""
from __future__ import annotations
import signal
from datetime import datetime
from enum import IntEnum
from functools import singledispatch
from io import BufferedReader, BytesIO
from types import FrameType, TracebackType
from typing import Any, Literal, NoReturn, Tupl... | StarcoderdataPython |
4848212 | import argparse
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import os
from random import shuffle
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autograd import Variable
import torch.nn.functional as F
from torch import optim
from torch.optim.lr_scheduler import M... | StarcoderdataPython |
5112521 | <gh_stars>1-10
from kafka import KafkaProducer
from os import environ
import tweepy
import json
import logging
class KafkaStreamListener(tweepy.StreamListener):
def __init__(self, producer, topic):
super(KafkaStreamListener, self).__init__()
self._producer = producer
self._topic = topic
... | StarcoderdataPython |
3470693 | <gh_stars>10-100
#Clair3 pileup parameters
REPO_NAME="Clair3"
import re
from itertools import accumulate
zstd='zstd'
default_optimizer = "Radam"
default_loss_function = "FocalLoss"
support_platform = {'ont', 'hifi','ilmn'}
min_af = 0.08
min_af_dict = {'ont':0.15, 'hifi':min_af, 'ilmn':min_af }
#as three platform train... | StarcoderdataPython |
11394315 | <filename>client/verta/verta/_swagger/_public/modeldb/model/PathLocationTypeEnumPathLocationType.py
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class PathLocationTypeEnumPathLocationType(BaseType):
_valid_values = [
"LOCAL_FILE_SYSTEM",
"NETWORK_FILE_SYSTEM",
... | StarcoderdataPython |
11291095 | import tensorflow as tf
import numpy as np
from absl.flags import FLAGS
@tf.function
def transform_targets_for_output(y_true, grid_size, anchor_idxs):
# y_true: (batch_size, (nbboxes), (x1, y1, x2, y2, class, best_anchor))
N = y_true.nrows()
# y_true_out: (N, grid, grid, anchors, [x, y, w, h, obj, class]... | StarcoderdataPython |
6606015 | def surname(user_data, with_separator=None):
return [user_data[-1]]
| StarcoderdataPython |
3446958 | <reponame>igarny/pscheduler
#
# Limit-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .args import *
from .limitproc import *
from .response import *
from .util import *
@application.route("/limits", methods=['GET'])
def limits():
try:
propo... | StarcoderdataPython |
171142 | import tensorflow as tf
import data_loader_recsys
import generator_recsys
import utils
import shutil
import time
import math
import eval
import numpy as np
import argparse
#check whether the files exists or not, "Data/Models/generation_model/model_nextitnet.ckpt"
# if yes run this file directly, if not run nextitre... | StarcoderdataPython |
8103711 | <reponame>meunierd/nlzss
#!/usr/bin/env python3
import sys
from sys import stdin, stdout, stderr, exit
from os import SEEK_SET, SEEK_CUR, SEEK_END
from errno import EPIPE
from struct import pack, unpack
__all__ = ('decompress', 'decompress_file', 'decompress_bytes',
'decompress_overlay', 'DecompressionErro... | StarcoderdataPython |
81167 | from flask_restful import Resource
from flask import request, jsonify, g
from marshmallow import ValidationError
from ..models import Todo , todo_schema, todos_schema, todo_schema_include_items
from ..util import validate_request, jwt_required
class TodoListResource(Resource):
@validate_request
@jwt_required... | StarcoderdataPython |
1850630 | import httpx
import pytest
from rubrix import DEFAULT_API_KEY
from rubrix.client import AuthenticatedClient, whoami
from rubrix.client.sdk.users.models import User
from tests.server.test_helpers import client
@pytest.fixture
def sdk_client():
return AuthenticatedClient(base_url="http://localhost:6900", token=DE... | StarcoderdataPython |
6458748 | #!/opt/bin/lv_micropython -i
import lvgl as lv
import display_driver
| StarcoderdataPython |
4863039 | from mode import Mode
from colormath.color_objects import XYZColor, sRGBColor
from colormath.color_conversions import convert_color
import re
class RGB(Mode):
@staticmethod
def get_params():
return('rgb', 'rgb_in_hex')
@staticmethod
def execute(light_utils, argument=None):
hex_pattern... | StarcoderdataPython |
3452427 | import formats.puzzle as pzd
from formats.binary import BinaryWriter
from formats.filesystem import NintendoDSRom
import unittest
import os
class TestPuzzleData(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
rom_path = os.path.dirname(__file__)
cls.rom = NintendoDSRom.fromFile(r... | StarcoderdataPython |
9726910 | <reponame>waterhorse1/Promp_test
from meta_policy_search import utils
from meta_policy_search.policies.base import Policy
from collections import OrderedDict
import tensorflow as tf
import numpy as np
class MetaAlgo(object):
"""
Base class for algorithms
Args:
policy (Policy) : policy object
... | StarcoderdataPython |
3283747 | '''
FileName: clipBoard.py
Author: Chuncheng
Version: V0.0
Purpose: Control Clip Board
'''
# %%
import time
import clipboard
# %%
default_message = time.ctime()
default_message
# %%
def copy(message=default_message):
'''
Method: copy
Copy [message] to the clipBoard,
Args:
... | StarcoderdataPython |
1893351 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# originally contributed by:
#Copyright 2014 Battelle Memorial Institute
#Written by <NAME>
# With additions from <NAME>, Bareos GmbH & Co. KG 2015
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Aff... | StarcoderdataPython |
6628542 | from typing import overload
@overload
def foo(value: None) -> None:
pass
@overload
def foo(value: int) -> str:
pass
@overload
def foo(value: str) -> str:
pass
def foo(value):
return None
foo(<arg1>) | StarcoderdataPython |
3250642 | #Copyright (c) 2009,2010 <NAME>
import numpy as num
import cudamat as cm
from cudamat import reformat
class LinearAutoencoder(object):
def __init__(self, numVis, numHid, mbsz = 256, initWeightSigma = 0.01):
self._mbsz = mbsz
self.numVis, self.numHid = numVis, numHid
self.visToHid = initWei... | StarcoderdataPython |
11347599 | <filename>y-cruncher/src/results.py
#!/usr/bin/env python3
import collections
import datetime
import math
import os
import pathlib
import re
import sys
import urllib.parse
from lib.ParseCruncherValidation import ParseCruncherValidation
# see "What Constants are Tracked" at http://www.numberworld.org/y-cruncher/reco... | StarcoderdataPython |
381482 | <reponame>RichardOkubo/PythonScripts<gh_stars>0
"""Avaliador de relação custo-benefício."""
import skfuzzy as fuzz
from numpy import arange
from skfuzzy import control as ctrl
def main():
"""Executa o simulador."""
print("\n------------------------- SIMULADOR -------------------------\n")
custo_max = roun... | StarcoderdataPython |
22276 | ##
## Evaluation Script
##
import numpy as np
import time
from sample_model import Model
from data_loader import data_loader
from generator import Generator
def evaluate(label_indices = {'brick': 0, 'ball': 1, 'cylinder': 2},
channel_means = np.array([147.12697, 160.21092, 167.70029]),
data... | StarcoderdataPython |
11394468 | <filename>tests/test_redis/test_bitop.py
from common import *
def test_bitop_in_master_slave():
nc = get_redis_conn(is_ms=True)
nc.execute_command('AUTH', redis_passwd)
nc.mset({'a': '111', 'b': '222', 'c': '333', 'd': '444'})
assert(nc.bitop('and', 'new_key', 'a', 'b', 'c', 'd'))
assert(nc.bitop('... | StarcoderdataPython |
9619980 | # coding=utf-8
"""
@author: <NAME>
@date: 07/20/2020
@description: Transform <filename.csv> data file to <torch.Dataset>
"""
import torch
from torch.utils.data import Dataset, DataLoader
from models.hierachical_attention_network.utils import load_ndarray
import torch.nn as nn
import numpy as np
class AgNewsDataset(... | StarcoderdataPython |
3531603 | from ..infrastructure import DockerUtils, WindowsUtils
from .base import DiagnosticBase
import os, platform
from os.path import abspath, dirname, join
class diagnostic8Gig(DiagnosticBase):
# The tag we use for built images
IMAGE_TAG = 'adamrehn/ue4-docker/diagnostics:8gig'
def getName(self):
'''
Returns th... | StarcoderdataPython |
1601253 | <reponame>adyaksaw/xendit-python
import pytest
import time
from .base_integration_test import BaseIntegrationTest
from tests.sampleresponse.direct_debit import (
customer_response,
multi_customer_response,
linked_account_response,
accessible_accounts_response,
payment_method_response,
multi_pay... | StarcoderdataPython |
6516112 | # -*- coding: utf-8 -
import codecs
import io
import os
from setuptools import setup
with io.open(os.path.join(os.path.dirname(__file__), 'README.md'),
encoding='utf-8') as f:
long_description = f.read()
setup(
name = 'bernhard',
version = '0.2.6',
description = 'Python client for Riemann'... | StarcoderdataPython |
1629680 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-20 13:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('comm... | StarcoderdataPython |
1688669 | from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('', include(('modules.activities.urls', 'activities'), namespace='activities')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| StarcoderdataPython |
119703 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2020 ICON Foundation 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 requir... | StarcoderdataPython |
1656263 | from Database import Database
class Users(object):
def __init__(self, idUsuario = 0, nome = '', telefone = '', email = '', usuario = '', senha = ''):
self.info = {}
self.idUsuario = idUsuario
self.nome = nome
self.telefone = telefone
self.email = email
self.usuario = usuario
self.senha = ... | StarcoderdataPython |
3318272 | <filename>amqpstorm/management/exception.py
from amqpstorm.exception import AMQPError
from amqpstorm.exception import AMQP_ERROR_MAPPING
class ApiError(AMQPError):
"""Management Api Error"""
def __init__(self, message=None, *args, **kwargs):
self._message = message
self._error_code = kwargs.p... | StarcoderdataPython |
87611 | <filename>_assignments/design-patterns/protocol/protocol_descriptor_b.py
"""
* Assignment: Protocol Descriptor ValueRange
* Complexity: easy
* Lines of code: 9 lines
* Time: 13 min
English:
1. Define descriptor class `ValueRange` with attributes:
a. `name: str`
b. `min: float`
c. `max: floa... | StarcoderdataPython |
21168 | <filename>backend/bios/apps.py
from django.apps import AppConfig
class BiosConfig(AppConfig):
name = 'bios'
| StarcoderdataPython |
3213058 | <gh_stars>1-10
import pyotp
import yaml
import argparse
import argcomplete
import os
from os.path import expanduser
from argcomplete.completers import ChoicesCompleter
def get_accounts():
file_path = os.path.join(expanduser('~'), '.otp-accounts.yml')
try:
with open(file_path, 'r') as stream:
... | StarcoderdataPython |
6625176 | import abc
import functools
from uqbar.objects import get_repr
from supriya.system import SupriyaObject
class SessionObject(SupriyaObject):
"""
A non-realtime session object, analogous to ServerObject.
"""
### CLASS VARIABLES ###
__documentation_section__ = "Session Internals"
__slots__ =... | StarcoderdataPython |
5086886 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-10 14:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0005_auto_20170610_2010'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
9663906 | import click
from flask.cli import AppGroup
from friday import storage
from friday.models import Recipe, RecipeImage
from friday.schemas import Recipe as RecipeSchema
recipe_group = AppGroup("recipe")
@recipe_group.command("new")
@click.argument("itemname")
@click.option("--name", "-n", multiple=True)
@click.option... | StarcoderdataPython |
6605857 | ## Command line functionality that calls ecg/ecg.py
| StarcoderdataPython |
1711190 | <reponame>waterloop/wcosa
"""
Main Script that calls other scripts to make wcosa work
"""
from __future__ import absolute_import
import argparse
from wcosa.command import handle, monitor, package_manager, use
from wcosa.info import __version__
from wcosa.objects.objects import Board, Fore, Generator, IDE, Path, Port... | StarcoderdataPython |
252680 |
import config
import sys
from subprocess import call
from PyQt5 import QtGui, QtCore
from PyQt5.QtCore import pyqtRemoveInputHook
from PyQt5.QtWidgets import QPushButton, QCheckBox, QWidget, QVBoxLayout, QLabel, QGroupBox, \
QHBoxLayout, QLineEdit, QRadioButton, QGridLayout, QComboBox, QFileDialog, QApplication, \... | StarcoderdataPython |
6404026 | """
Tests for system.output module.
"""
import pytest
import test_common.system.output as system_output
@pytest.mark.output
def test_log_function_output():
with system_output.OutputLogger.get_logger() as logger:
expected_value = "Hello world!"
expected_value_2 = "Bye"
print(expected_value)... | StarcoderdataPython |
11393167 | <reponame>juliawestermayr/schnetpack
import argparse
from argparse import ArgumentParser
from schnetpack.datasets import (
QM9,
ANI1,
MD17,
OrganicMaterialsDatabase,
MaterialsProject,
)
class StoreDictKeyPair(argparse.Action):
"""
From https://stackoverflow.com/a/42355279
"""
def ... | StarcoderdataPython |
334075 | <reponame>MarvinTeichmann/tensorflow_examples
import tensorflow as tf
import re
import params
IMAGE_SIZE = params.image_size
NUM_CHANNELS = params.num_channels
IMAGE_PIXELS = IMAGE_SIZE * IMAGE_SIZE
NUM_CLASSES = params.num_classes
def weight_variable(name, shape, stddev=0.1):
initializer = tf.truncated_normal_ini... | StarcoderdataPython |
1649527 | <reponame>quantastica/qconvert-py
# This code is part of quantastica.qconvert
#
# (C) Copyright Quantastica 2019.
# https://quantastica.com/
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at... | StarcoderdataPython |
163526 | <gh_stars>0
from ModelOptions import compute_local_fragility
import Fragility.GlobalRegression
if compute_local_fragility:
import Fragility.LocalCurve
| StarcoderdataPython |
9775068 | # -*- coding: utf-8 -*-
"""
Universal Language Model Fine-tuning for Text Classification (ULMFiT).
Code by <NAME>
https://github.com/cstorm125/thai2fit/
Some pre-processing functions are from fastai (Apache 2.0)
https://github.com/fastai/fastai/blob/master/fastai/text/transform.py
Universal Language Model Fine-tunin... | StarcoderdataPython |
11224606 | from django.urls import path, include
app_name = 'shitter'
urlpatterns = [
path('', include('shitter.api.urls', namespace='shitter_api')),
]
| StarcoderdataPython |
3370986 | <reponame>erykoff/fgcm
import numpy as np
import os
import sys
import esutil
import time
from .fgcmUtilities import retrievalFlagDict
from .fgcmUtilities import MaxFitIterations
from .fgcmUtilities import Cheb2dField
from .fgcmUtilities import objFlagDict
from .fgcmNumbaUtilities import numba_test, add_at_1d, add_at_... | StarcoderdataPython |
11396585 | <gh_stars>1-10
# This file is part of the clacks framework.
#
# http://clacks-project.org
#
# Copyright:
# (C) 2010-2012 GONICUS GmbH, Germany, http://www.gonicus.de
#
# License:
# GPL-2: http://www.gnu.org/licenses/gpl-2.0.html
#
# See the LICENSE file in the project's top-level directory for details.
"""
.. _dbus... | StarcoderdataPython |
9774388 | <reponame>yaniv-aknin/flask-s3upload
#!/usr/bin/env python
from base64 import b64encode
from datetime import datetime, timedelta
from json import dumps
from os import environ
from uuid import uuid4
import hmac
import sha
from flask import Flask, render_template, jsonify
app = Flask(__name__)
for key in ('AWS_ACCESS_... | StarcoderdataPython |
3219309 | from __future__ import annotations
from dataclasses import dataclass
from logging import Logger, getLogger
from pathlib import PosixPath
from typing import Optional, Union
import h5py
import numpy as np
from .application_info import get_application_info
from .fast5s import (
FAST5_ROOT,
KEY,
BaseFile,
... | StarcoderdataPython |
1608486 | #!/usr/local/bin/pyleabra -i
# Copyright (c) 2019, The Emergent Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# use:
# pyleabra -i ra25.py
# to run in gui interactive mode from the command line (or pyleabra, import ra25)
# see main... | StarcoderdataPython |
11260087 | <reponame>nazroll/gilacoolbot
import bot
from flask import Flask
from flask_restful import Api
app = Flask(__name__)
api = Api(app)
api.add_resource(bot.facebook.MainHandler, '/facebook/')
if __name__ == '__main__':
app.run(debug=True)
| StarcoderdataPython |
11222573 | import warnings
from .defaults import * # noqa
try:
from .locals import * # noqa
except ImportError:
warnings.warn(
'No settings file found. Did you remember to '
'copy local-dist.py to local.py?', ImportWarning,
)
| StarcoderdataPython |
81029 | """
2D–3D Geometric Fusion network using Multi-Neighbourhood Graph Convolution for RGB-D indoor scene classification
2021 <NAME> <<EMAIL>>
"""
import torch
import os
import argparse
from tqdm import tqdm
import twostream_network as models
from pc_img_h5_dataset import PCIMGH5Dataset, custom_collate
from Fus... | StarcoderdataPython |
1622573 | from typing import Any
from .base import api_function, BaseFunction
from ..request import Request
class Manager(BaseFunction):
"""
Provides controlling of the gateway/manager servers.
.. versionadded:: 18.12
"""
@api_function
@classmethod
async def status(cls):
"""
Retur... | StarcoderdataPython |
11264886 | 'yanna'
#!/usr/bin/env python3
import sys
from Crypto.PublicKey import RSA
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def modinv(a, m):
g, x, _ = egcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
... | StarcoderdataPython |
3461231 | """Tests for the apns component."""
| StarcoderdataPython |
6568332 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.interfaces.utils import propagateClkRstn, addClkRstn
from hwt.simulator.simTestCase import SimTestCase
from hwt.synthesizer.unit import Unit
from hwtLib.amba.axi4Lite import Axi4Lite
from hwtLib.amba.axiLite_comp.sim.ram import Axi4LiteSimRam
from hwtLib.amba.axi... | StarcoderdataPython |
1749457 | # FCC ULS Callsign Search
# Author: <NAME>
# Repository: https://github.com/cyberphilia/fcc_uls_callsign_search
# Callsign:W4NTS
# Quick Start: python .\fcc_uls_callsign_search.py
import os
import time
from ftplib import FTP
from zipfile import ZipFile
import callsign
import database
# from pathlib import Pat... | StarcoderdataPython |
5046426 | """
94 Free Cash - https://codeforces.com/problemset/problem/237/A
"""
def main():
n = int(input())
d = {}
for _ in range(n):
x, y = map(int, input().split())
if (x,y) not in d:
d[(x,y)] = 1
else:
d[(x,y)] += 1
dd = sorted(d.items(), key= lambd... | StarcoderdataPython |
128099 | <reponame>LovelyA72/ScoreDraft
from .Instrument import Instrument
from .Catalog import Catalog
try:
from .Extensions import InitializeKarplusStrongInstrument
from .Extensions import KarplusStrongSetCutFrequency
from .Extensions import KarplusStrongSetLoopGain
from .Extensions import KarplusStrongSetSustainGain
Ca... | StarcoderdataPython |
288957 | import matplotlib.pyplot as plt
import numpy as np
import pytest
from numba_celltree import demo
def test_close_polygons():
faces = np.array(
[
[0, 1, 2, -1, -1],
[0, 1, 2, 3, -1],
[0, 1, 2, 3, 4],
]
)
closed = demo.close_polygons(faces, -1)
expecte... | StarcoderdataPython |
6703616 | # extract_upstream_regions.py
# script that accepts a 2 column file of locus
# ids and a boolean flag of whether than locus
# might be in an operon. It returns a fasta file
# from 1 base before the ATG through -300bp
# upstream for all genes NOT possibly in an operon.
import argparse
from Bio import SeqIO
import os
i... | StarcoderdataPython |
12863027 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponse
from .models import Image,Category,Location
def gallery_today(request):
gallery = Image.objects.all()
return render(request, 'all-galleries/today-gallery.html', {"gallery": gallery})
def search_results(request):
if '... | StarcoderdataPython |
8047181 | import json
import requests
from http import client as http_client
import pickle
import os
from bs4 import BeautifulSoup
from factorial.exceptions import AuthenticationTokenNotFound, UserNotLoggedIn, ApiError
import hashlib
import logging
import logging.config
import random
from datetime import date
from constants impo... | StarcoderdataPython |
6609012 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-16 01:03
from __future__ import unicode_literals
import common.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('addresses', '0001_initial'),
(... | StarcoderdataPython |
1758256 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.nn.init as init
from torch.nn.parameter import Parameter
from torch.nn.utils.rnn import pad_packed_sequenc... | StarcoderdataPython |
6481549 | import numpy as np
import random
from nltk.corpus import wordnet as wn
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_string('action', '', '')
def get_word(vocab=None, action = None, this_word=None):
if FLAGS.action == 'no_up' and action == 2:
return vocab.word2id(this_word)
... | StarcoderdataPython |
11253936 | # Lib imports
import os
from flask import Flask, render_template, jsonify, request
from flask_alembic import Alembic
from flask_caching import Cache
from flask_compress import Compress
from flask_cors import CORS
from flask_language import Language, current_language
from flask_mail import Mail
from flask_marshmallow i... | StarcoderdataPython |
1943736 | <filename>test/e2e/main.py
import inspect
import os
import sys
import time
from difflib import Differ
from os.path import dirname
import argparse
import yaml
import requests
import time
from requests import Response
try:
from yaml import CSafeLoader as Loader
except ImportError:
from yaml import SafeLoader as Loa... | StarcoderdataPython |
1897899 | <filename>chb/cmdline/mips/chx_get_callgraph_paths.py
#!/usr/bin/env python3
# ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: <NAME>
# ------------------------------------------------------------------------------
# The ... | StarcoderdataPython |
8163800 | """initial revision
Revision ID: 352a78d78066
Revises:
Create Date: 2017-10-03 00:30:04.946456
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '352a78d78066'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto g... | StarcoderdataPython |
6557100 | <filename>twitter-analytics/code/1-training_data_preparation/mturk/check_hit_status.py
import boto3
import os
import argparse
def get_args_from_command_line():
"""Parse the command line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument("--HITId", type=str)
args = parser.parse_args()... | StarcoderdataPython |
5095241 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.3... | StarcoderdataPython |
3322943 | #!/usr/bin/env python
from cement.core import foundation, controller
from lib import get_backend, set_backend
from monitor import *
from pprint import PrettyPrinter
pprint = PrettyPrinter(indent=2).pprint
backend = get_backend()
def my_split(p):
"""
splits args based on '=' delim
:return:
"""
... | StarcoderdataPython |
9765719 | <gh_stars>10-100
import re
def get_content(soup):
"""Retrieves contents of the article"""
# heuristics
div_tags = soup.find_all('div', id='articleContentBody')
div_tags_2 = soup.find_all('div', class_='ArticleText')
div_tags_3 = soup.find_all('div', id='ArticleText')
div3 = soup.find_all('div'... | StarcoderdataPython |
6635616 | """
Defines the Location widget which allows changing the href of the window.
"""
import json
import urllib.parse as urlparse
import param
from ..models.location import Location as _BkLocation
from ..reactive import Syncable
from ..util import parse_query
from .state import state
class Location(Syncable):
"""... | StarcoderdataPython |
9794914 | <gh_stars>100-1000
from typing import Text, Any, Dict, Optional, Union, List
import aiohttp
ANY_DATA = Optional[Dict[Any, Any]]
async def get(url: Text, params: ANY_DATA = None) -> Union[List[Dict], Dict[Any, Any]]:
async with aiohttp.ClientSession() as session:
async with session.get(url, params=params... | StarcoderdataPython |
3240592 | # -*- coding: utf-8 -*-
"""
sphinx.directives.patches
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives impor... | StarcoderdataPython |
3259237 | from django.urls import path, include
from . import views
urlpatterns = [
# Home Page URLs
path('', views.home, name="home"),
path(r'^logout/$', views.logoutUser, name="logout"),
path('about/', views.about, name="about"),
# Registrations
path('customer-registration/', views.cusRegister,
... | StarcoderdataPython |
3329486 | <reponame>RBGKew/PAFTOL_Validation_Pipeline
#!/usr/bin/env python
# coding: utf-8
# # GetOrganelles Cleaning
##################################
# Author: <NAME>
# Copyright © 2020 The Board of Trustees of the Royal Botanic Gardens, Kew
##################################
# In[1]:
import os
import shutil
import sys... | StarcoderdataPython |
8181564 | <reponame>juangea/B28_boneMaster
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later vers... | StarcoderdataPython |
393619 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage YVertical.
# <NAME>, <EMAIL>
#
#
from ppmessage.core.imageconverter import ImageConverter
from ppmessage.core.audioconverter import AudioConverter
from ppmessage.core.constant import REDIS_DISPATCHER_NOTIFICATION_KEY
from ppmessage.core.constant import RED... | StarcoderdataPython |
11282355 | import sys
from basket import Basket
from product_store import ProductStore
from offer_store import OfferStore
class CheckoutSystem(object):
def __init__(self):
self._product_store = ProductStore.load_from_config_file()
self._offer_store = OfferStore.load_from_config_file()
self._basket =... | StarcoderdataPython |
3415959 | <filename>passivehunter.py
'''
Author : <NAME>
Note : I initially made this script for my personal use , Now making it public.
I did not cared much about best coding practices as it was just a personal script
'''
from status_check import make_requests
from error_handling import error_handler
from collections import ... | StarcoderdataPython |
46694 | <reponame>kaniblu/enwiki-mysql
# encoding: utf-8
from __future__ import unicode_literals
import re
import string
import six
import gensim
class WikiBodyFilter(object):
"""Generic wikipedia article filter
Strips off illegal characters and markups. Borrows some basic logic from
gensim utils.
"""
... | StarcoderdataPython |
5027140 | """add url column to movies table
Revision ID: 51eac6822fe3
Revises: <PASSWORD>
Create Date: 2017-12-15 10:50:31.866000
"""
# revision identifiers, used by Alembic.
revision = '51eac6822fe3'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('movies', sa.C... | StarcoderdataPython |
3545218 | <gh_stars>1-10
from simulatedisease import *
import numpy.random
import matplotlib.pylab
from optimise_stops import *
if __name__=='__main__':
save_figures = True
numpy.random.seed(2)
field_size = [100, 100]
num_groups = 2
num_stops = 20
origin = np.array([50,50])
opts = {}
'''
o... | StarcoderdataPython |
4947611 | <reponame>CodeChain-io/codechain-sdk-python
from .transaction import Transaction
class Remove(Transaction):
pass
| StarcoderdataPython |
215337 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | StarcoderdataPython |
1868208 | from __future__ import absolute_import
from __future__ import unicode_literals
import mock
from django.core.exceptions import ValidationError
from django.test import TestCase
from simplemathcaptcha.widgets import MathCaptchaWidget
from simplemathcaptcha.fields import MathCaptchaField
class FieldTests(TestCase):
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.