id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3384421 | from django import forms
from django.forms import ModelForm
from django.forms.widgets import TextInput
from accounts.forms import LongCharField
from core.models import Message, Room
class MessageForm(ModelForm):
""" Form for chat messages """
message_id = forms.IntegerField(required=False)
class Me... | StarcoderdataPython |
47499 | <reponame>c4s4/mysql_commando
#!/usr/bin/env python
# encoding: UTF-8
from distutils.core import setup
setup(
name = 'mysql_commando',
version = 'VERSION',
author = '<NAME>',
author_email = '<EMAIL>',
packages = ['mysql_commando'],
url = 'http://pypi.python.org/pypi/mysql_commando/',
licen... | StarcoderdataPython |
3334017 | <reponame>eshbeata/open-paperless
from __future__ import unicode_literals
default_app_config = 'documents.apps.DocumentsApp'
| StarcoderdataPython |
1799285 | <reponame>andrewtavis/poli-sci-k
"""
Appointment Method Checks
-------------------------
Functions to conditionally check appointment methods.
Contents:
quota_condition,
consistency_condition
"""
from math import ceil, floor
import pandas as pd
from poli_sci_kit.appointment.metrics import ideal_share
def ... | StarcoderdataPython |
139252 | <gh_stars>10-100
import unittest
from unittest import mock
from tethys_apps.management.commands import pre_collectstatic
class ManagementCommandsPreCollectStaticTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_add_arguments(self):
mock_parser = ... | StarcoderdataPython |
3386473 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import json
import pytest
from micropy.exceptions import StubError
from micropy.stubs import source
def test_get_source(shared_datadir, test_urls, test_repo):
"""should return correct subclass"""
test_path = shared_datadir / "esp8266_test_stub"
local_stub = sou... | StarcoderdataPython |
1654330 | from bs4 import BeautifulSoup
from re import search as re_search
from bgg_regex import clean_integer, clean_float
# get initial game data of all games on given rank page
def bgg_scrape_rank_page(soup):
partial_bgg_data = {}
rows = soup.find_all('tr', {'id': 'row_'})
for row in rows:
columns = row.... | StarcoderdataPython |
3343303 | <filename>catkin_ws/src/ligong_control/src/kinematic_model.py
##################################
#Project: The kinematic model for ligong legged robot`s gait
#Author:<NAME>
#Time: 2019-11-29
##################################
import numpy as np
import math
step_trip = 0.075
offset = 0.15
step_angle = math.pi / 12
tur... | StarcoderdataPython |
3250922 | <filename>Somalia-COVID-impact/Compare_projections.py
import matplotlib.pyplot as plt
import pandas as pd
import os
from pandas.core import base
dir_path = os.path.dirname(os.path.realpath(__file__))
for disease in ["Cholera","Malaria","Measles"]:
baseline=pd.read_excel(f'{dir_path}/Results_Baseline_{disease}_Nat... | StarcoderdataPython |
1789201 | <filename>NippoKun/report/urls.py
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import login, logout
from . import views
from .views import (
CreateReport,
ListReport,
ListMyReport,
DetailReport,
UpdateReport,
DeleteRep... | StarcoderdataPython |
3232002 | <reponame>cloudinary/pycloudinary<gh_stars>100-1000
import contextlib
import unittest
from cloudinary.utils import normalize_expression, generate_transformation_string
NORMALIZATION_EXAMPLES = {
'None is not affected': [None, None],
'number replaced with a string value': [10, '10'],
'empty string is not a... | StarcoderdataPython |
3220265 | import pygame
import math
import numpy as np
from pygame.locals import *
class Wheel():
def __init__(self, window, colour, pos, size):
self.window = window
self.colour = colour
self.size = size
self.pos = np.array(pos)
self.ang = 0.0
self.mat = np.array([[math.cos(... | StarcoderdataPython |
1727319 | import pandas as pd
import plotly as py
import plotly.graph_objs as go
#import excel file
failed = pd.read_csv('banklist.csv')
#list of states(unique)
failed_states = list(set(failed['ST']))
#list of years(unique). had to strip last 2 characters of column to get the year then sort the list
failed_years = sorted(list(s... | StarcoderdataPython |
171691 | <reponame>mcmaxwell/frontier<gh_stars>0
from modeltranslation.translator import translator, TranslationOptions
from .models import News
from common.translation import CommonPostTranslationOptions
class NewsTranslationOptions(TranslationOptions):
fields = ('title', 'text_preview', 'text')
translator.register... | StarcoderdataPython |
1700425 | from python_framework import Serializer, HttpStatus, JwtConstant
from MessageEmitterAnnotation import MessageEmitter
from MessageEmitterAnnotation import MessageEmitterMethod
from config import MessageConfig
import MessageDto
import Message
@MessageEmitter(
url = MessageConfig.EMITTER_URL,
timeout = MessageC... | StarcoderdataPython |
1792298 | <filename>tests/test_format.py
# pyflyby/test_format.py
# License for THIS FILE ONLY: CC0 Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import, division, with_statement
from textwrap import dedent
from pyflyby._format import... | StarcoderdataPython |
1686192 | import math
import pandas
import random
import os
import numpy as np
import tensorflow
from pandas import DataFrame
from tensorflow.keras.utils import Sequence
class DataSequence(Sequence):
"""
Keras Sequence object to train a model on a list of csv files
"""
def __init__(self, rootdir, batch_size, s... | StarcoderdataPython |
1717578 | """
constants.py
"""
from binascii import unhexlify, hexlify
from base64 import b64encode as b64e
from base64 import b64decode as b64d
# NOTE: delay experiments
ARTIFICIAL_DELAY = 4.0
ARTIFICIAL_DELAY_INCREMENT = 0.5
# NOTE: estimated delays
NC_EKA_PERIOD = 5.0 # sec
NC_EKA_TIMEOUT = 31.0 # sec
# NOTE: ECDH
POI... | StarcoderdataPython |
126617 | from numpy.core.fromnumeric import take
from gi.repository import Gtk, GLib, Gio
from matplotlib.backends.backend_gtk3agg import (
FigureCanvasGTK3Agg as FigureCanvas)
from matplotlib.figure import Figure
import numpy as np
import time
import threading
import serial
# from pyfirmata import Arduino, util
from steppe... | StarcoderdataPython |
1634556 | from warcsigner.warcsigner import RSASigner, sign_cli, verify_cli
from pytest import raises
import shutil
import os
import tempfile
from io import BytesIO
def abs_path(filename):
return os.path.join(os.path.dirname(os.path.realpath(__file__)), filename)
TEST_WARC = abs_path('test_warc.warc.gz')
TEMP_SIGNED_WARC... | StarcoderdataPython |
3299505 | #!/usr/bin/env python
"""ADC Demo
This demo initializes pin 0 as an analog input and illustrates using the
analog_voltage_changed event to notify user code (in this case, a lambda
expression) when the voltage at the pin exceeds its threshold.
This script will run until terminated or board.disconnect() is called by
p... | StarcoderdataPython |
3364810 | # xpyBuild - eXtensible Python-based Build System
#
# This module holds definitions that are used throughout the build system, and
# typically all names from this module will be imported.
#
# Copyright (c) 2013 - 2017, 2019 Software AG, Darmstadt, Germany and/or its licensors
#
# Licensed under the Apache License, ... | StarcoderdataPython |
1773408 | <filename>youtube/migrations/0004_auto_20201202_1100.py
# Generated by Django 2.2 on 2020-12-02 05:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('youtube', '0003_auto_20181019_1947'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
70196 | #############################################################
## ##
## Copyright (c) 2003-2017 by The University of Queensland ##
## Centre for Geoscience Computing ##
## http://earth.uq.edu.au/centre-geoscience-computing ##
## ... | StarcoderdataPython |
4836619 | <reponame>outloudvi/mw2fcitx
# This collation file is for moegirl.org.
# It MIGHT NOT be fit for other wikis.
from ..utils import normalize
def dont_have(string: str, array: [str]):
for i in array:
if string.find(i) != -1:
return False
return True
def split_and_merge_single(group: [str],... | StarcoderdataPython |
3328046 | import os, os.path
import csv
import math
import numpy
import gzip
from isodist.Isochrone import Isochrone, FEH2Z, Z2FEH, dict2recarray
from isodist.PadovaIsochrone import _DATADIR
_ANZSOLAR= 0.0176
_ZS= [-0.1,-0.2,-0.3,-0.5,-1.,-1.5,-2.,-3.,0.,0.1,0.2,0.4]
class AnIsochrone (Isochrone):
"""Class that represents a ... | StarcoderdataPython |
1775315 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 3 09:34:48 2021
Objective: Yahoo stock price data analysis
@author: Ashish
"""
# load required libraries
import pandas as pd
import yfinance as yf
import matplotlib.pyplot as plt
import numpy as np
from pandas.plotting import scatter_matrix
# load data
start_date = "2010... | StarcoderdataPython |
156662 | # Copyright (c) 2021 <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the followin... | StarcoderdataPython |
108848 | <filename>common/logger_conf.py
# Copyright (c) 2017 Intel Corporation
#
# 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,... | StarcoderdataPython |
133821 | import uuid
from django.core.exceptions import ValidationError
from arches.app.functions.base import BaseFunction
from arches.app.models import models
from arches.app.models.tile import Tile
import json
import logging
from django.db.models import Q
logger = logging.getLogger(__name__)
details = {
"name": "Increme... | StarcoderdataPython |
3272094 | from .base import SimulatorException, SimulationResult
from .scipyode import ScipyOdeSimulator
from .cupsoda import CupSodaSimulator
from .stochkit import StochKitSimulator
from .bng import BngSimulator, PopulationMap
__all__ = ['BngSimulator', 'CupSodaSimulator', 'ScipyOdeSimulator',
'StochKitSimulator', '... | StarcoderdataPython |
3258197 | <filename>djeff/djeff.py
import re
from django.template.backends.django import DjangoTemplates, Template
from django.template.engine import _dirs_undefined
try:
from html.parser import HTMLParser
except ImportError:
from HTMLParser import HTMLParser
class DjeffTemplates(DjangoTemplates):
def get_template... | StarcoderdataPython |
1786979 | """Config flow for Air Touch 3."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from .const import DOMAIN
from .s7comm import S7Comm
DATA_SCHEMA = vol.Schema({vol.Required(CONF_HOST): str})
class S7CommConfigFlow(config_entries.ConfigFlow, domain=DOMAIN... | StarcoderdataPython |
1631278 | <filename>bin/vehicle-inspector.py<gh_stars>0
#! /usr/bin/env python
from smartcameras.subscriber import VehicleInspector
import threading
def main():
print("########################################")
print ""
print("Welcome to the Vehicle Inspector!")
print ""
print("############################... | StarcoderdataPython |
1788017 | <filename>fairmodels/plot_ceteris_paribus_cutoff.py
import numpy as np
import pandas as pd
from .plotnine import *
def plot_ceteris_paribus_cutoff(cpc):
data = cpc.cutoff_data
models = cpc.label
n_models = len(models)
min_data = cpc.min_data
min_data["y"] = [np.min(data.parity_loss)] * n_models
... | StarcoderdataPython |
3205205 | <reponame>MartinSeeler/Advent-of-Code<filename>2020/day20/solution.py
from math import prod, sqrt
transpose = lambda tile: list(''.join(line) for line in zip(*tile))
invert = lambda tile: [''.join(reversed(line)) for line in tile]
rotate = lambda tile: invert(transpose(tile))
def parse(text: str):
tiles = dict()
... | StarcoderdataPython |
3310003 | # Copyright (c) 2018-2020, <NAME>
# Copyright (c) 2021, Auburn University
# This file is part of the azplugins project, released under the Modified BSD License.
import numpy as np
import hoomd
hoomd.context.initialize()
from hoomd import md
try:
from hoomd import azplugins
except ImportError:
import azplugins... | StarcoderdataPython |
1693346 | """Check module for command."""
# Official Libraries
from argparse import Namespace
# My Modules
from stobu.types.command import CmdType
__all__ = (
'has_cmd_of',
)
# Define Constants
COMMAND_TABLE = {
CmdType.ADD: ('a', 'add'),
CmdType.BUILD: ('b', 'build'),
CmdType.COPY: ... | StarcoderdataPython |
1681172 | <gh_stars>0
import torch.nn as nn
from collections import OrderedDict
from mmdet.models.plugins import ConcatFeatureMap, ScaleAwareLayer, SpatialAwareLayer, TaskAwareLayer
import torch
import torch.nn.functional as F
class DyHead_Block(nn.Module):
def __init__(self, L, S, C):
super(DyHead_Block, self).__i... | StarcoderdataPython |
3360621 | <reponame>wavestate/wavestate-control<filename>src/wavestate/control/statespace/ace_electrical.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOT... | StarcoderdataPython |
1616300 | from nice65.utils.addressing import AddressParser
class Disassembler:
def __init__(self, mpu, address_parser=None):
if address_parser is None:
address_parser = AddressParser()
self._mpu = mpu
self._address_parser = address_parser
self.addrWidth = mpu.ADDR_WIDTH
... | StarcoderdataPython |
24717 | import re
import pprint
pp = pprint.PrettyPrinter(indent=4)
from sys import version_info # py3, for checking type of input
def combine_messages(messages):
""" Combines messages that have one or more integers in them, such as
"trial001" "trial002", into a single message like "trial# (#=1-2)".
Thi... | StarcoderdataPython |
4829350 | <reponame>lhoupert/hvplot<gh_stars>100-1000
from unittest import TestCase, SkipTest
try:
import numpy as np
import networkx as nx
import hvplot.networkx as hvnx
except:
raise SkipTest('NetworkX not available')
class TestOptions(TestCase):
def setUp(self):
# Create nodes (1-10) in unsorted... | StarcoderdataPython |
1751881 | <gh_stars>10-100
from django.contrib.auth.models import User
__all__ = ["User"]
| StarcoderdataPython |
1606396 | from substrateinterface import Keypair
from substrateinterface import SubstrateInterface
from pathlib import Path
from brownie import *
import base58
from hashlib import blake2b
import json
import yaml
from pathlib import Path
from colorama import Fore, Back, Style, init
import os
init(autoreset=True)
NETWORK=os.get... | StarcoderdataPython |
107367 | <gh_stars>0
#
# Solution to Project Euler Problem 1
# by <NAME>
#
# Answer: 233168
#
NUM = 1000
# Compute sum of the naturals that are a multiple of 3 or 5 and less than [NUM]
def compute():
return sum(i for i in range(1, NUM) if i % 3 == 0 or i % 5 == 0)
if __name__ == "__main__":
print(compute())
| StarcoderdataPython |
3238849 | <reponame>Alirezaja1384/MajazAmooz
"""
Django settings for core project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1... | StarcoderdataPython |
1664999 | <filename>ojos_ca/interface/view/django/core.py
import sys
from logging import basicConfig, getLogger, INFO
from typing import Any, List
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from d... | StarcoderdataPython |
1766750 | #!/usr/bin/env python
#
# This code calculates LQR gains for a drone system whose reference signal is obtained
# by differential flatness. The input to the system is the body frame thrust and body
# frame angular velocities, and output is the world frame position, velocity and
# angular position given by euler angles.... | StarcoderdataPython |
1663223 | '''cont = 1
while cont < 10:
print(cont)
cont += 1'''
n = 1
par = impar = 0
while n != 0:
n = int(input('Digite um valor: '))
if n != 0:
if n % 2 == 0:
par += 1
else:
impar += 1
print('Você digitou {} números pares e {} números ímpares!'.format(par, impar)) | StarcoderdataPython |
3205730 | import numpy as np
import random
import math
from scipy import signal
class RoadGenerator():
def __init__(self):
self.L = 300 # Length of Road Profile (m)
self.B = 0.1 # Sampling Interval (m)
self.dn = 1/self.L # Frequency Band (1/m)
self.n0 = 0.1 # Spatial Freq... | StarcoderdataPython |
4834867 | <filename>lib/__init__.py
#/usr/bin/env python3
"""Module Init"""
import lib.cfgparser, lib.utils
import lib.preprocess_era5inp, lib.air_parcel
| StarcoderdataPython |
4835485 | <reponame>HireIQ/django-session-security
import time
import unittest
from django.test.client import Client
from django import test
from session_security.utils import set_last_activity, get_last_activity
from datetime import datetime, timedelta
from .test_base import SettingsMixin
class MiddlewareTestCase(SettingsMi... | StarcoderdataPython |
93517 | """
Provides anadroid version information.
"""
# This file is auto-generated! Do not edit!
# Use `python -m incremental.update anadroid` to change this file.
from incremental import Version
__version__ = Version("anadroid", 0, 5, 26)
__all__ = ["__version__"]
| StarcoderdataPython |
1668477 | """Google Analytics Reporting API v4 Metrics."""
from easy_gar.base import Metric
class ReportingMetric(Metric):
"""Analytics Metric class."""
def __init__(self, expression, alias=None, formatting_type=None):
super().__init__(expression, alias, formatting_type)
def __call__(self):
"""Re... | StarcoderdataPython |
3247408 | import numpy as np
import pytest
import nept
toy_array = np.array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
def test_find_nearest_idx():
assert nept.find_nearest_idx(toy_array, 13) == 3
assert nept.find_nearest_idx(toy_array, 11.49) == 1
assert nept.find_nearest_idx(toy_array, 11.51) == 2
assert... | StarcoderdataPython |
37122 | <gh_stars>0
import time
import torch
from torch.distributions.dirichlet import Dirichlet
from detectron2.engine.train_loop import SimpleTrainer
class LinearScalarizationTrainer(SimpleTrainer):
"""
A simple trainer for the most common type of task:
single-cost single-optimizer single-data-source iterative... | StarcoderdataPython |
70496 | #
# Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending
#
# add JDK to path (otherwise jnius gives DLL load error)
import os
os.environ['PATH'] = os.environ['PATH'] + ";C:\\Program Files\\Java\jdk1.8.0_72\\jre\\bin\\server"
os.environ['PATH'] = os.environ['PATH'] + ";C:\\Program Files\\Java\jdk1.8.0_60\\jre... | StarcoderdataPython |
150234 | <gh_stars>1-10
# Copyright © 2019 Province of British Columbia
#
# 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 applic... | StarcoderdataPython |
163261 | import uuid
import imghdr
import os
from cStringIO import StringIO
from flask import Flask, request, redirect, render_template, url_for, flash, jsonify
from flask_s3 import FlaskS3
import boto3
import requests
from cat import CatThat
FINISHED_FOLDER = 'finished'
S3_BUCKET = 'cats.databeard.com'
ALLOWED_EXTENSIONS = ... | StarcoderdataPython |
47840 | import numpy
import pandas as pd
from boo.columns import SHORT_COLUMNS
from boo.errors import UnclassifiableCodeError
QUOTE_CHAR = '"'
EMPTY = int(0)
NUMERIC_COLUMNS = SHORT_COLUMNS.numeric
def adjust_rub(df, cols=NUMERIC_COLUMNS):
rows = (df.unit == "385")
df.loc[rows, cols] = df.loc[rows, cols].multiply(1... | StarcoderdataPython |
3210533 | # -*- coding: utf-8 -*-
from allauth.account.adapter import get_adapter
from rest_auth.registration.serializers import RegisterSerializer
class UserSerializer(RegisterSerializer):
def save(self, request):
adapter = get_adapter()
user = adapter.new_user(request)
self.cleaned_data = self.get... | StarcoderdataPython |
3291316 | <reponame>lnfjpt/GraphScope<filename>python/graphscope/nx/algorithms/tests/forward/test_assortativity.py
import networkx.algorithms.assortativity.tests.base_test
import networkx.algorithms.assortativity.tests.test_connectivity
import networkx.algorithms.assortativity.tests.test_correlation
import networkx.algorithms.as... | StarcoderdataPython |
3370050 | import os
import sys
# Add all the python paths needed to execute when using Python 3.6
sys.path.append(os.path.join(os.path.dirname(__file__), "models"))
sys.path.append(os.path.join(os.path.dirname(__file__), "models/arc"))
sys.path.append(os.path.join(os.path.dirname(__file__), "skiprnn_pytorch"))
sys.path.append(o... | StarcoderdataPython |
3263684 | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from plot_2d_from_json import plot_community
from tqdm import tqdm
import json
import os
if __name__ == '__main__':
os.makedirs('image_data', exist_ok=True)
canvas_size = 1000
with open('ReCo_json.json', encoding='utf-8') as f:
data = json.l... | StarcoderdataPython |
3375437 | from validation.param_check import ParamCheck
class SmartRegisterParamCheck(ParamCheck):
def __init__(self, params):
self.barcode = params['barcode'] if 'barcode' in params else None
self.order_id = params['orderId'] if 'orderId' in params else None
self.items = params['items'] if 'items' ... | StarcoderdataPython |
3358118 | import os
import requests
from pprint import pprint
import yaml
class Playlists():
def __init__(self):
self.data = self.read_file()
self.login(self.data)
self.playlists = self.data.get('playlists')
def login(self, data):
user_id = self.data.get('server_data').get('user_id')
... | StarcoderdataPython |
1705441 | <filename>parametersConfig.py
to = {''}
gmail_user = {''}
gmail_pwd = {''} | StarcoderdataPython |
69699 | <gh_stars>10-100
"""A kernel manager for in-process kernels."""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.
from traitlets import Instance, DottedObjectName, default
from jupyter_client.managerabc import KernelManagerABC
from jupyter_client.manager import K... | StarcoderdataPython |
19042 | <reponame>kyungjaelee/robosuite<gh_stars>0
# utility functions for manipulating MJCF XML models
import xml.etree.ElementTree as ET
import os
import numpy as np
from collections.abc import Iterable
from PIL import Image
from pathlib import Path
import robosuite
RED = [1, 0, 0, 1]
GREEN = [0, 1, 0, 1]
BLUE = [0, 0, 1,... | StarcoderdataPython |
3253323 | """Functions for the Error-replacing Portion
Functions that are responsible for the process of generating possible corrections, swapping out mask tokens
with the corrections, and returning the new sentence list.
"""
import error_detection_functions as edf
import torch
def initialize_suggestion_list(suggestion_num):... | StarcoderdataPython |
69035 | <reponame>jozhang97/mmsegmentation
_base_ = [
'../_base_/models/upernet_swin.py', '../_base_/datasets/uvo_finetune.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(
pretrained='PATH/TO/YOUR/swin_large_patch4_window12_384_22k.pth',
backbone=dict(
pretrai... | StarcoderdataPython |
4804247 | <gh_stars>10-100
from sc2maptool import main
from sc2maptool import functions as f
from sc2maptool import index
from sc2maptool import selectMap
from sc2maptool import standardizeMapName
from sc2maptool.mapRecord import MapRecord
def test_main():
import sys
sys.argv = ['', "--mapname=MechDepot", "--list", "--... | StarcoderdataPython |
178205 | <reponame>hodgka/super_res_demo
"""Settings configuration - Configuration for environment variables can go in here."""
import os
from keras.models import load_model
import tensorflow as tf
from dotenv import load_dotenv
load_dotenv()
ENV = os.getenv('FLASK_ENV', default='production')
DEBUG = ENV == 'development'
SQL... | StarcoderdataPython |
3294914 | <filename>settings/staging.py
MONGODB_DATABASES = {
'name': 'mongo',
'host': 'localhost',
'port': 27017,
'password': '<PASSWORD>',
'username': 'root',
'database': 'toplist',
'tz_aware': True
} | StarcoderdataPython |
1663566 | <reponame>deokershesh/IfxPy
#
#
#
import unittest, sys
import IfxPy
import config
from testfunctions import IfxPyTestFunctions
class IfxPyTestCase(unittest.TestCase):
def test_231_FieldTypeName(self):
obj = IfxPyTestFunctions()
obj.assert_expect(self.run_test_231)
def run_test_231(self):
conn = I... | StarcoderdataPython |
110250 | import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from web.lib.base import BaseController, render
log = logging.getLogger(__name__)
class FormtestController(BaseController):
def index(self):
# Return a rendered templ... | StarcoderdataPython |
186519 | <filename>luffy/models/layers/__init__.py
from .activation import *
from .attention import *
from .mlp import *
from .transformer import *
| StarcoderdataPython |
3367671 | <filename>light.py
from light_modes import *
import win32com.client
import config
import light_board
auraSdk = win32com.client.Dispatch("aura.sdk.1")
auraSdk.SwitchMode()
board = light_board.light_board(auraSdk)
def update_light():
if config.MODE == config.MODES.RANDOM:
light_random.light_random(board)
... | StarcoderdataPython |
3309597 | <filename>vies/models.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _
from . import VATIN_MAX_LENGTH, forms
class VATINField(CharField):
"""
Database field for Europe... | StarcoderdataPython |
44837 | <filename>marketplace/migrations/0003_auto_20171106_1454.py
# Generated by Django 2.0b1 on 2017-11-06 14:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0002_auto_20171106_1452'),
]
operations ... | StarcoderdataPython |
3267965 | # -*- coding: utf-8 -*-
###############################################################################
#
# Live Plotting of Received LSL Time Series.
#
# - <NAME>, 2016
###############################################################################
#
# license info here...
#
##################################... | StarcoderdataPython |
87186 | """
Custom backend example
"""
import random
from frontera import FrontierManager, Settings, FrontierTester, graphs
from frontera.contrib.backends.memory import MemoryBaseBackend
SITE_LIST = [
[('http://google.com', [])],
[('http://scrapinghub.com', [])],
[('http://zynga.com', [])],
[('http://microso... | StarcoderdataPython |
1750138 | <filename>Smart_container/PaddleClas/deploy/python/test.py
#图片处理
import base64
import binascii
import hashlib
import json
import os
from typing import Container
import memcache
import pymysql
import requests
from django.http import JsonResponse
from django.shortcuts import HttpResponse, render
#检索
from fuzzywuzzy impo... | StarcoderdataPython |
3388006 | <filename>src/westpa/analysis/__init__.py
from westpa.analysis.core import Run
from westpa.analysis.statistics import time_average
from westpa.analysis.trajectories import Trajectory, BasicMDTrajectory
__all__ = ['Run', 'time_average', 'Trajectory', 'BasicMDTrajectory']
| StarcoderdataPython |
3391847 | # -*- coding: utf-8 -*-
import time
from scrapy.contrib.linkextractors.lxmlhtml import LxmlLinkExtractor
from scrapy.spiders import Rule
from scrapy_redis.spiders import RedisCrawlSpider
from fish_core.scrapy.items import CommonItem
from fish_core.simhash import Simhash
class SimpleCrawler(RedisCrawlSpider):
""... | StarcoderdataPython |
3376040 | from __future__ import absolute_import, division, print_function
from .index import *
from .core import *
try:
from .dask import *
except ImportError:
pass
| StarcoderdataPython |
180628 | from django.contrib import admin
from .models import User, UserOutreach, UserStatus, Logging
admin.site.register(UserStatus)
admin.site.register(UserOutreach)
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'question_id', 'points', 'xp')
search_fields = ('email', 'userna... | StarcoderdataPython |
1723733 | def TP(a,b,c):
if(a**2+b**2==c**2):
return "YES"
else:
return "NO"
print("Enter a,b,c : ",end="")
try:
a,b,c=map(int,input().split())
print(TP(a,b,c))
except:
print("Invalid input")
| StarcoderdataPython |
1683485 | <reponame>milkrong/Basic-Python-DS-Algs<filename>LeetCode/longest_palindrome.py
import collections
class Solution:
def longestPalindrome(self, s: str) -> int:
ans = 0
for v in collections.Counter(s).values():
ans += v // 2 * 2
if ans % 2 == 0 and v % 2 == 1:
... | StarcoderdataPython |
4801377 | <filename>bert_train.py
import torch
from torch import nn
import json
from torch.utils.data import DataLoader, RandomSampler, TensorDataset
from pytorch_pretrained_bert import BertModel, BertAdam
from pytorch_pretrained_bert.modeling import BertPreTrainedModel
import train_args as parse
from m_io import create_output_... | StarcoderdataPython |
3217248 | # Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
3366990 | <gh_stars>0
from nic.datapreparation.data import (
features_size,
load_captions,
load_data,
load_images,
load_tokenizer,
vocabulary_size,
)
from nic.datapreparation.downloading import (
download_mscoco,
split_out_test_data,
)
from nic.datapreparation.preprocessing import (
ImageOptio... | StarcoderdataPython |
150604 | #!/usr/bin/env python3
theInput = """785 516 744
272 511 358
801 791 693
572 150 74
644 534 138
191 396 196
860 92 399
233 321 823
720 333 570
308 427 572
246 206 66
156 261 595
336 810 505
810 210 938
615 987 820
117 22 519
412 990 256
405 996 423
55 366 418
290 402 810
31... | StarcoderdataPython |
165559 | <filename>DEN/run_fdc.py
import torch
from torch.utils import data
from torchvision.transforms import Compose
from torchvision.models import resnet152
import os
import fdc
import transforms_nyu
from dataset import NyuV2, KITTIdataset
from den import DEN
data_path = '/data/nyu_v2/'
seed = 2
torch.manual_seed(seed)
d... | StarcoderdataPython |
3386199 | <reponame>JerryRain/rrt_ws
#!/usr/bin/env python
# rrt.py
# This program generates a simple rapidly
# exploring random tree (RRT) in a rectangular region.
#
# Written by <NAME>
# May 2011
import sys, random, math, pygame
from pygame.locals import *
from math import sqrt,cos,sin,atan2
#constants
XDIM = 640
YDIM = 480... | StarcoderdataPython |
3209670 | from .client import (Client, Tensor, BlobTensor, DType, Device, Backend)
| StarcoderdataPython |
3279334 | """Tools for decoding and executing a neural network from its genetic representation."""
from typing import Tuple
import numpy as np
from .executable import Executable
##############################
# Function sigmoid
##############################
def sigmoid(x):
"""A logistic sigmoid activation function. Acc... | StarcoderdataPython |
3304206 | #"issubclass" es capaz de identificar una relación entre dos clases,
# y aunque su diagnóstico no es complejo, puede verificar si una clase particular
# es una subclase de cualquier otra clase.
#Cada clase se considera una subclase de sí misma.
class Vehiculo:
pass
class VehiculoTerrestre(Vehiculo):
pass
clas... | StarcoderdataPython |
83716 | # coding=utf-8
from __future__ import unicode_literals
from datetime import datetime, timedelta
from pub_site.constant import WithdrawState
from pub_site.withdraw import dba as withdraw_dba
from pub_site import pay_client
from pub_site.sms import sms
from tools.utils import to_bankcard_mask
def fetch_notify_withdraw... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.