id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3214148 | <filename>venv/lib/python3.6/site-packages/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/logging_global/logging_global.py
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolu... | StarcoderdataPython |
3214626 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap, BoundaryNorm
from collections import OrderedDict
from matplotlib.animation import FuncAnimation
from gym import utils
import sys
from six import StringIO, b
from IPython.display import HTML
COLORS = OrderedDict([
(b"W... | StarcoderdataPython |
1620226 | import cv2
import numpy as np
import os.path
from cv2 import WINDOW_NORMAL
from face_detection import find_faces
ESC = 27
def start_webcam(model_emotion, model_gender, window_size, window_name='live', update_time=50):
cv2.namedWindow(window_name, WINDOW_NORMAL)
if window_size:
width, height = window_... | StarcoderdataPython |
3367603 | from debug_toolbar.toolbar.loader import DebugToolbar
from debug_toolbar_htmltidy.panels import HTMLTidyDebugPanel
from django.conf import settings
from django.test import TestCase
from dingus import Dingus
import os
class Settings(object):
"""Allows you to define settings that are required
for this functi... | StarcoderdataPython |
3219873 | <reponame>NewShadesDAO/api
from typing import List
from umongo import Document, MixinDocument, Reference, fields
from app.helpers.dates import get_mongo_utc_date
from app.helpers.db_utils import instance
@instance.register
class DatetimeMixin(MixinDocument):
created_at = fields.AwareDateTimeField(default=get_mo... | StarcoderdataPython |
102537 | <filename>font_convert.py<gh_stars>0
#!/usr/bin/env python3
from PIL import Image
import argparse
import sys
gif_width = 2048
font_height = 8
skip_stripes = 1
stripes = 4
def bin2header(data, var_name='var'):
out = []
out.append('static constexpr uint8_t {var_name}[] = {{'.format(var_name=var_name))
l = [ data[i... | StarcoderdataPython |
3296305 | <filename>tests/models.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from django.db import models
from django.dispatch import receiver
from bulk_signals import signals
def create_stub(*args, **kwargs):
pass
@receiver(signals.post_bulk_create)
def call_create_stub(*args, **kwargs):
create_stub(*args, **kwargs)
... | StarcoderdataPython |
1660336 | <filename>transciptionTesting.py
from transcribeSR import getHarvardAudioText
from transcribeGCSTT import processAudioinfileGCSTT
from runJiwer import determineAccuracy
from processSampleText import processHarvardSentenceList
from timeit import default_timer
from pathlib import Path
# set this to True to test one... | StarcoderdataPython |
4825320 | <reponame>kz0817/mylab
#!/usr/bin/env python3
def show_func(idx):
func_string_arr = [
'int func%04d(const int a, const int b)' % idx,
'{',
' return a % b;',
'}',
'',
]
print('\n'.join(func_string_arr));
def main():
for i in range(50000):
show_func(i)
... | StarcoderdataPython |
1688609 | #
# Author : <NAME>
# Project : trackhub-creator
# Timestamp : 03-07-2017 11:10
# ---
# © 2017 <NAME> <<EMAIL>>
# All rights reserved.
#
"""
Pipeline related exceptions
"""
from exceptions import AppException
class PipelineDirectorException(AppException):
def __init__(self, value):
super(AppExcept... | StarcoderdataPython |
111841 | # Generated by Django 2.2.6 on 2020-02-01 21:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fetcher', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='fetchrun',
name='source',
... | StarcoderdataPython |
48558 | from .reproducibility import set_random_seed
from .training import EarlyStopping
from .dataset import get_dataloader, imread
from .model_evaluation import (
get_conditional_means,
get_conditional_variances,
spearman_corr,
)
from .scoring_functions import (
Correlation,
get_loglikelihood,
) | StarcoderdataPython |
197041 | <reponame>vprzybylo/COCPIT
from pydoc import classname
import dash_bootstrap_components as dbc
from dash import dcc, html
import globals
from datetime import date
from dash_extensions.enrich import Input, Output, State, ServersideOutput, dcc
def sidebar():
sidebar = html.Div(
children=[
dbc.R... | StarcoderdataPython |
4816572 | from samplics.weighting.adjustment import SampleWeight
from samplics.weighting.replicates import ReplicateWeight
__all__ = ["SampleWeight", "ReplicateWeight"]
| StarcoderdataPython |
3261684 | """
Найти сумму n элементов следующего ряда чисел: 1, -0.5, 0.25, -0.125,…
Количество элементов (n) вводится с клавиатуры.
Пользователь вводит только натуральные числа.
"""
n = int(input("Укажите число элементов: "))
e = 1
s = 0
for i in range(n):
s += e
e /= -2
print(s)
| StarcoderdataPython |
1773592 | import os
import time
input_file = open('notes.txt', 'r')
content = str(input_file.read())
#replacement section
content = content.replace('dis4', '311')
content = content.replace('ais4', '466')
content = content.replace('gis4', '415')
content = content.replace('dis5', '622')
content = content.replace('dis5', '622')
... | StarcoderdataPython |
3284967 | #!/usr/bin/env python3
#
# Copyright 2016 Canonical 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 o... | StarcoderdataPython |
1667113 | <reponame>Alwyndev/Hospital_Management
import mysql.connector as sql
def get_password():
while True:
try:
password = input("Create password: ")
retyped_password = input("Retype password: ")
if password != retyped_password:
raise ValueError
el... | StarcoderdataPython |
46389 | import asyncio
import glob
import os
import random
import subprocess
import sys
import wave
from collections import defaultdict
from contextlib import suppress
from datetime import datetime
from functools import partial
from itertools import count, islice
from pathlib import Path
from typing import Default... | StarcoderdataPython |
4832321 |
class ServerEventBuffer:
def __init__(self, air, name, avId, period = None):
self.air = air
self.name = name
self.avId = avId
if period is None:
period = 6 * 60.0
self.period = period
self.lastFlushTime = None
return
def destroy(self):
... | StarcoderdataPython |
3254909 | <gh_stars>0
"""
Dataframes listing assays in batteries.
"""
from __future__ import annotations
from typeddfs.df_typing import DfTyping
from sauronlab.core.core_imports import *
class AssayFrame(TypedDf):
"""
A Pandas DataFrame that has one row per assay in a battery.
Each row has:
- assay_positions... | StarcoderdataPython |
69082 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
'''This examples shows how to copy a file to a remote
host via SRM using a custom security context.
If something doesn't work as expected, try to set
SAGA_VERBOSE=3 in your environment before you run the
sc... | StarcoderdataPython |
3250721 | <reponame>joewalk102/Adafruit_Learning_System_Guides
from adafruit_circuitplayground.express import cpx
cpx.pixels.brightness = 0.3
while True:
if cpx.button_a:
cpx.pixels[2] = (0, 255, 0)
elif cpx.button_b:
cpx.pixels[7] = (0, 0, 255)
else:
cpx.pixels.fill((0, 0, 0))
| StarcoderdataPython |
1786238 | from __future__ import print_function, division, absolute_import
import os
from fontTools.misc.py23 import *
from ufo2ft.preProcessor import (
OTFPreProcessor, TTFPreProcessor, TTFInterpolatablePreProcessor)
from ufo2ft.featureCompiler import FeatureCompiler
from ufo2ft.outlineCompiler import OutlineOTFCompiler,... | StarcoderdataPython |
3319494 | <reponame>nikibreg/30-min-blog<gh_stars>1-10
from flask import Flask, request, jsonify, render_template
import sqlite3
import os
import datetime
app = Flask ('app', template_folder='templates')
def initSQL():
# os.remove('database.db')
db = sqlite3.connect('database.db')
cur = db.cursor()
cur.execute("CREATE... | StarcoderdataPython |
1776223 | #/usr/bin/python
#encoding=utf-8
from .Base import *
import re
pattern_color = re.compile(r'#([a-f0-9A-F]+)')
class FEDHexColorShouldUpper(RuleChecker):
'''{
"summary":"16进制颜色大写&缩写",
"desc":"<p>浏览器会先将小写的颜色值转换成大写,所以写成大写格式可以省略这部分的开销,并且尽量省略,例如:
</br><code>color:#ffffff; </code><br/><code... | StarcoderdataPython |
1774602 | <gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-#
# Copyright (c) 2008-2016, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | StarcoderdataPython |
10104 | <reponame>Dundee/python-sqlpuzzle<filename>sqlpuzzle/_common/argsparser.py
from sqlpuzzle.exceptions import InvalidArgumentException
__all__ = ('parse_args',)
# pylint: disable=dangerous-default-value,keyword-arg-before-vararg
def parse_args(options={}, *args, **kwds):
"""
Parser of arguments.
dict opti... | StarcoderdataPython |
158681 | <reponame>shawnmckinney/py-fortress
'''
@copyright: 2022 - Symas Corporation
'''
import sys
import argparse
from rbac.model import PermObj, Perm, User, Role, Constraint
from rbac import review, admin
from rbac.cli.utils import print_user, print_role, print_ln, print_entity
from rbac.util.fortress_error import RbacError... | StarcoderdataPython |
3267857 | import json
from nameko.web.handlers import http
from buzzer import dependencies
class BuzzerService:
name = 'buzzer'
rmq = dependencies.Broker()
'''
POST /buzzer
Body: { 'turn_on': boolean, 'duration': float|int }
'''
@http('POST', '/buzzer')
def do_post(self, reque... | StarcoderdataPython |
3252233 | <filename>util.py<gh_stars>10-100
"""Utility functions."""
import torch
from torch_geometric.utils import degree, softmax, subgraph
from torch_sparse import SparseTensor
from torch_geometric.utils import remove_self_loops, add_self_loops
import sys, os
import os.path as osp
sys.path.append(os.path.join(os.path.dirname(... | StarcoderdataPython |
3268080 | #!/usr/bin/env python3
import unittest
from migen import *
from litex.soc.cores.gpio import GPIOOut
from ..endpoint import *
from ..io import FakeIoBuf
from ..pid import PIDTypes
from ..rx.pipeline import RxPipeline
from ..tx.pipeline import TxPipeline
from .header import PacketHeaderDecode
from .send import TxPack... | StarcoderdataPython |
55489 | import pandas as pd
import glob
# alpha3Codeをindexに設定して読み込む
country_data = pd.read_csv('../../country.csv', keep_default_na=False, index_col=0)
# 空行を除いて3行目からデータがスタートする(適宜要調整)
# 2列目の「Country Code」をindexに設定する。country.csvと同じ値が入るカラムをindexに指定する必要がある(適宜要調整)
raw_csv = glob.glob('API*.csv')[0]
data = pd.read_csv(raw_csv, hea... | StarcoderdataPython |
4817358 | import urllib.parse
import urllib.request
def request(url):
response = urllib.request.urlopen(url)
return response.read().decode('utf-8')
pass | StarcoderdataPython |
4809846 | <filename>Nov5Example_notebook.py
#%% [markdown]
# See results_notebook.py for a more complicated analysis example (used to replicate some analyses from a previous SERP-related paper).
#
# This file is meant to provide a very quick starting point for writing up other analyses.
#%% [markdown]
# # Current data forma... | StarcoderdataPython |
56768 | <reponame>ICT4H/dcs-web
from unittest import TestCase
import unittest
from django.contrib.auth.models import User
from mock import patch, Mock, MagicMock
from datawinners.project.submission.submission_import import SubmissionPersister, SubmissionWorkbookValidator, SubmissionWorkbookMapper, ImportValidationError
from ma... | StarcoderdataPython |
142538 | <filename>grid-world/a2c_ppo_acktr/utils.py<gh_stars>1-10
import os, time, csv, copy
from graph.graph_utils import dotdict
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import numpy as np
#from a2c_ppo_acktr.envs import VecNormalize
def _update_print_log(args, logs, it, num_updates, start, ... | StarcoderdataPython |
3224053 | <filename>pymocky/server/cherrypy_status.py
import re
from pymocky.models.config import Config
from pymocky.utils.log import Log
class CherryPyStatus(object):
def __init__(self, mapping_handler):
self.mapping_handler = mapping_handler
def response(self):
string = "<html>"
string += "... | StarcoderdataPython |
3262830 | <filename>flaskrestlessapiclient/zzz_manual_install.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Install your own package in one seconds! (For Windows, MacOS, Linux system)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Put this script in your package directory, for ... | StarcoderdataPython |
163646 | <filename>CLIP/bin/bin_count_to_bed.py
#!/usr/bin/env python
import sys
i=0
for line in sys.stdin:
if line[0] == '#':
continue
i += 1
cols = line.strip('\n').split('\t')
if cols[4] != '0':
sys.stdout.write('%s\n' % '\t'.join([cols[0], cols[1], cols[2], 'bed%s' % i, cols[4], cols[3... | StarcoderdataPython |
3311952 | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from properties.api.views import *
app_name='property-api'
urlpatterns = [
path('properties/create-property-stage-opportunity/', CreatePropertyStageOpportunityAPIView.as_view(), name='create-property-stage-op... | StarcoderdataPython |
47169 | import unittest
import numpy as np
from bert2tf import Executor, ElectraDiscriminator, BertTokenizer
from tests import Bert2TFTestCase
class MyTestCase(Bert2TFTestCase):
@unittest.skip('just run on local machine')
def test_create_electra_model(self):
model = Executor.load_config('ElectraDiscriminato... | StarcoderdataPython |
3356332 | <gh_stars>1-10
from discord import embeds
from discord.ext import commands
import discord
import math
from helpers.paginator import Paginator
class TagName(commands.Converter):
async def convert(self, ctx, argument: str):
argument = await commands.clean_content().convert(ctx, argument)
argument =... | StarcoderdataPython |
3295336 | <reponame>Fernal73/LearnPython3
#!/usr/bin/env python
def factorial(x):
result = 1
for i in range(2, x + 1):
result *= i
return result
if __name__ == "__main__":
import sys
x = int(sys.argv[1])
sys.stdout.write(f"{factorial(x)}\n")
| StarcoderdataPython |
78476 | """
Merge Sort
1. Divide the unsorted list into n sublists, each containing one element (a
list of one element is considered sorted).
2. Repeatedly merge sublists to
produce new sorted sublists until there is only one sublist remaining. This
will be the sorted list.
"""
def merge_sort(arr):
"""
merge sort
... | StarcoderdataPython |
3268071 | import slackweb
import json
from utils import Option
option = Option()
slack = slackweb.Slack(url=option.incoming_webhook_url)
def notify(args):
slack.notify(text = args.TEXT)
def send(args):
color = args.color
title = args.title
text = args.text
main_text = args.TEXT
attachments = [{'color'... | StarcoderdataPython |
186952 | <gh_stars>0
from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse
from django.http import Http404
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate
from django.conf import settings
from django.shortcuts import red... | StarcoderdataPython |
3210814 | # https://stackoverflow.com/questions/9117512/python-scipy-numpy-convolve-and-scipy-signal-fftconvolve-different-results
# https://stackoverflow.com/questions/16895405/whats-the-difference-between-scipy-ndimage-filters-convolve-and-scipy-signal-co
| StarcoderdataPython |
4825532 | <reponame>WebArchivCZ/WA-KAT
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import sys
import bz2
import json
import os.path
import argparse
import marcxml_parser
from tqdm import tqdm
# Functions &... | StarcoderdataPython |
3236931 | <gh_stars>1-10
# -*- coding:utf-8 -*-
import sys
sys.path.append("C:\Users\Administrator\Desktop\VNPY\My_Strategies")
from datetime import datetime
from vnpy.trader.utility import load_json, save_json
from strategies.AAA import AAA
if __name__ == "__main__":
# 更新配置文件数据库名称
setting = load_json("vt_setting.js... | StarcoderdataPython |
3358986 | from math import inf
from collections import deque
graph = []
"""
The graph is represented as sets of tuples in lists.
The tuples stored in graph[i] are the edges of the graph.
The first value of the tuple is the peer node,
and the second value is the weight (cost).
"""
def dijkstra(graph, starting_node):
visited... | StarcoderdataPython |
3201457 | """
prepare and save dataframe for eda, model training and evaluation :
Data Source :
deepdr : https://isbi.deepdr.org
kaggle : https://www.kaggle.com/c/aptos2019-blindness-detection/
merge two datasets :
- deepdr dataset have : train, valid, test dataset with image quality and diagnosis label
- kaggle dataset have :... | StarcoderdataPython |
100211 | <filename>tests/common/checks_infra/test_registry.py
import os
import unittest
from checkov.common.checks_infra.registry import Registry
from checkov.common.checks_infra.checks_parser import NXGraphCheckParser
class TestRegistry(unittest.TestCase):
def test_invalid_check_yaml_does_not_throw_exception(self):
... | StarcoderdataPython |
1726117 | <gh_stars>1-10
# Downloads Hubspot contacts.
# Usage:
# * HUBSPOT_API_KEY=[INSERT] python -i examples/hubspot_contacts.py
# * Access the dataframe via `contacts.df`
import os
# Loads dev-specific configuration if env var. DEV=true.
if (os.getenv("DEV") == 'true'):
import dev_config
import petaldata
# Configuratio... | StarcoderdataPython |
3338167 | class BaseParallelException(Exception):
pass
class TimeoutException(BaseParallelException):
def __eq__(self, other):
return type(self) == type(other)
class ParallelStatusException(BaseParallelException):
pass | StarcoderdataPython |
100781 | <gh_stars>1-10
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.40
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
# This file is compatible with both classic and new-style classes.
from sys import version_info
if ve... | StarcoderdataPython |
3264054 | """The token_auth_history database table."""
from __future__ import annotations
from sqlalchemy import Column, DateTime, Enum, Index, Integer, String
from sqlalchemy.dialects import postgresql
from gafaelfawr.models.token import TokenType
from gafaelfawr.schema.base import Base
__all__ = ["TokenAuthHistory"]
clas... | StarcoderdataPython |
74017 | <gh_stars>0
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class BlogApp(CMSApp):
name = "Blog"
urls = ["blog.urls"]
app_name = "blog"
apphook_pool.register(BlogApp) | StarcoderdataPython |
1663814 | # MIT License
#
# Copyright (c) 2021 <NAME>
#
# 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, merge, publi... | StarcoderdataPython |
190420 | <reponame>FunkyCracky/AdventOfCode2020
def part01(input, slope_right, slope_down):
total = 0
pos = 0
for i in range(0, len(input), slope_down):
if input[i][pos] == "#":
total += 1
pos = (pos + slope_right) % len(input[i])
return total
def part02(input):
return part01(inp... | StarcoderdataPython |
3306155 |
# Poslanci a Osoby
# Agenda eviduje osoby, jejich zařazení do orgánů a jejich funkce v orgánech a orgány jako takové.
# Informace viz https://www.psp.cz/sqw/hp.sqw?k=1301.
from os import path
import pandas as pd
import numpy as np
from parlamentikon.utility import *
from parlamentikon.Snemovna import *
from parlame... | StarcoderdataPython |
118704 | <reponame>aniziorodrigues/meerk40t<filename>meerk40t/device/moshi/moshidevice.py
import threading
import time
from ...core.drivers import Driver
from ...core.plotplanner import PlotPlanner
from ...kernel import (
STATE_ACTIVE,
STATE_BUSY,
STATE_END,
STATE_IDLE,
STATE_INITIALIZE,
STATE_PAUSE,
... | StarcoderdataPython |
65094 | <gh_stars>1-10
# Copyright 2017-2019 The FIAAS 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 l... | StarcoderdataPython |
43465 | from server import Server
import os
def file_exists(server, name):
out, _ = server.run("ls")
print(out)
files = out.strip().split("\n")
print(files)
return name in files
if __name__ == "__main__":
server = Server(host = "192.168.3.11", user="ubuntu", key_filename="/Users/greg/.ssh/lightsail-oh... | StarcoderdataPython |
4818020 | <filename>ml_progress/display.py<gh_stars>0
class Display():
def update(self, metric: str, width: int):
raise NotImplementedError | StarcoderdataPython |
3218407 | <filename>src/states/playstate.py
import pygame
from pygame.color import THECOLORS
from pygame.constants import K_LEFT, K_RIGHT, K_SPACE, KEYDOWN, KEYUP
from src.levels import level
from src.objects import BALL, HEART, SLIDER
from src.states.basestate import Base
from src.spritesheet import SpriteSheet, blocks, balls,... | StarcoderdataPython |
3238082 | <filename>ex001nome.py
nome = input('Qual é o seu nome?')
print('Prazer em conhecê-lo', nome,'!') | StarcoderdataPython |
1671217 | <gh_stars>1-10
from numpy import array
from sklearn.svm import LinearSVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
class Predict:
def __init__(self):
data = eval(open("predictors/vectors", "r").read())
self.__vector = []
self.__g... | StarcoderdataPython |
113380 | import pytest
from django_oso.models import AuthorizedModel, authorize_model
from django_oso.oso import Oso, reset_oso
from django.core.management import call_command
from app.models import Post, User
@pytest.fixture(autouse=True)
def reset():
reset_oso()
@pytest.fixture
def users():
(manager, _) = User.o... | StarcoderdataPython |
3276694 | <gh_stars>1-10
"""
Unit tests of ..wavefields module.
(c) 2019-2020 <NAME>.
Copywright: Ask for permission writing to <EMAIL>.
"""
from unittest import TestCase
from fullwavepy.project.files.gridded.wavefields import *
class TestFoo(TestCase):
"""
"""
pass
# s = 'foobar'
# self.assertE... | StarcoderdataPython |
194077 | <gh_stars>1-10
from dialogs import delay
from dialogs import initialiser
from dialogs import setvoltage
from dialogs import stepvoltage
from dialogs import readvoltage
from dialogs import sendreceive
from dialogs import test
from dialogs import setup
from dialogs import addfunction
from dialogs import callfunction
f... | StarcoderdataPython |
1763656 | <reponame>pulumi/pulumi-keycloak<gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, O... | StarcoderdataPython |
4820464 | <reponame>wotreeclapton/Exam-Creator<gh_stars>0
#! python3
'''
EXAM CREATOR LAUNCHER developed by <NAME>
Feb. 2020
SAMROIYOD, <NAME>, THAILAND
[See license.txt file]
temp change
'''
__author__ = '<NAME>'
__version__ = '1.1.1'
import os
import sys
import csv
import openpyxl
from app_guis import Ui_CreateCSVWi... | StarcoderdataPython |
1691307 | # Generated by Django 3.1 on 2020-08-11 20:13
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('davematthews', '0009_auto_20200811_1917'),
]
operations = [
migrations.AlterField(
mo... | StarcoderdataPython |
54882 | import os
def delete_log():
if os.path.exists('pyfibre.log'):
os.remove('pyfibre.log')
| StarcoderdataPython |
29727 | {
'includes': ['common.gypi'],
'conditions': [
['OS == "win"', {
'variables': {
'application_platform%': 'Win32',
'renderers%': ['Direct3D11', 'GL4'],
'audio%': 'XAudio2',
'input_devices%': ['DirectInput'],
},
}],
['OS == "mac"', {
'variables': {
... | StarcoderdataPython |
1748020 | <reponame>zbj-labs/openalex-guts<gh_stars>0
from cached_property import cached_property
from sqlalchemy import text
from sqlalchemy import orm
from sqlalchemy.orm import selectinload
from sqlalchemy.sql.expression import func
from sqlalchemy.orm import deferred
from sqlalchemy.orm import foreign, remote
from collection... | StarcoderdataPython |
3278322 | class Solution:
def XXX(self, numRows: int) -> List[List[int]]:
ret=[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
if numRows<6:return ret[:numRows]
for i in range(5,numRows):
d=[1]
n=i-1
for j in range(n):
d.append(ret[n][j]+ret[n][j+1])
... | StarcoderdataPython |
95038 | from argparse import ArgumentParser
def main():
parser = ArgumentParser()
parser.add_argument("indent", type=int, help="indent for report")
parser.add_argument("input_file", help="read data from this file") #1
parser.add_argument("-f", "--file", dest="filename", #2
help... | StarcoderdataPython |
59441 | <gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# author: chinshin
# datetime: 2020/4/20 15:41
import sys
import tqdm
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from .optim_schedule import Scheduleoptim
from bert.model import MolBertLM, MolBertDis, Line... | StarcoderdataPython |
113171 | """
Contains routes for main purpose of app
"""
from datetime import datetime
from flask import render_template, flash, redirect, url_for, request, current_app
from flask_login import current_user, login_required
from app import db
from app.main.forms import EditProfileForm, PostForm
from app.models import User, Post
f... | StarcoderdataPython |
4837926 | <filename>api/models.py<gh_stars>0
from django.db import models
from django.contrib.postgres.fields import JSONField
class FebJson(models.Model):
id = models.AutoField(primary_key=True)
content = JSONField()
class MarJson(models.Model):
id = models.AutoField(primary_key=True)
content = JSONField()
... | StarcoderdataPython |
3272809 | def parse(lines):
def parse_coord(coord):
return tuple([int(x) for x in coord.split(",")])
result = []
for line in lines:
start, end = [parse_coord(coord) for coord in line.split(" -> ")]
result.append((start, end))
return result
def get_vent_delta(vent):
def g... | StarcoderdataPython |
2833 | # -*- encoding: utf8 -*-
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from lvq import SilvqModel
from lvq.utils import plot2d
def main():
# Load dataset
dataset = np.loadtxt('data/artificial_dataset1.csv', delimiter=',')
x = dataset[:... | StarcoderdataPython |
3331878 | <reponame>YannHyaric/evolutionary-computation<gh_stars>0
import warnings
import numpy as np
INVALID_VALUE = 1000
def concepts_covered_function(individual, instance, timer):
objectives = instance.objectives
concepts_materials = instance.concepts_materials
missing_concepts_coeficient = instance.missing_co... | StarcoderdataPython |
98015 | <gh_stars>0
import sys
sys.path.insert(0, '../Utils')
from Utils import Constants # pylint: disable=import-error
from Item import Item
class HealingItem(Item):
def __init__(self, name, desc, price, healing_type, amount):
super().__init__(name, desc, price)
self.healing_type = healing_ty... | StarcoderdataPython |
22636 | <filename>networkx/classes/tests/test_digraph_historical.py
#!/usr/bin/env python
"""Original NetworkX graph tests"""
from nose.tools import *
import networkx
import networkx as nx
from networkx.testing.utils import *
from historical_tests import HistoricalTests
class TestDiGraphHistorical(HistoricalTests):
def ... | StarcoderdataPython |
67382 | from .linemode import MetaIndexLinemode
| StarcoderdataPython |
3373773 | <filename>core/da/dal.py
import abc
from core.expense import Expense
from core.expense_category import ExpenseCategory
from core.store import Store
from core.person import Person
from core.payment_type import PaymentType
class DataAccessLayer (metaclass=abc.ABCMeta):
def __init__( self ) :
pass
... | StarcoderdataPython |
3275426 | <gh_stars>10-100
import pytest
@pytest.mark.parametrize("fake_needs_update", [True, False])
def test_check_and_compare_version(fake_needs_update, mocker):
from dbt_sugar.core.utils import check_and_compare_version
# mock the call to pypi
mocker_result = "0.0.0"
if fake_needs_update:
mocker_re... | StarcoderdataPython |
3292532 | from setuptools import setup, find_packages
setup(
name = 'ci',
version = '0.0.1',
url = 'https://github.com/hail-is/hail.git',
author = '<NAME>',
author_email = '<EMAIL>',
description = 'Hail CI/CD System',
packages = find_packages(),
include_package_data=True
)
| StarcoderdataPython |
4833061 | <filename>serial_driver/launch/serial_driver_bridge_node.launch.py
# Copyright 2021 The Autoware Foundation
#
# 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/lice... | StarcoderdataPython |
129941 | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
51740 | """
Scrape card info from pokemon-card.com
and save as csv file
author: type-null
date: July 2020
"""
import bs4
import sys
import requests
import pandas as pd
def getContent(cardId):
# anti-scraping
user_agent = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0"
url = f'https:/... | StarcoderdataPython |
41985 | <reponame>dchaplinsky/pep.org.ua<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0072_auto_20160210_0246'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
3367810 | <reponame>cipher982/birb-watch
import os
import numpy as np
import onnxruntime
import torch
from stream_utils.onnx import (
letterbox,
non_max_suppression,
Annotator,
scale_coords,
Colors,
)
class YOLOv5ONNX:
def __init__(self, model_path):
self.model = onnxruntime.InferenceSession(m... | StarcoderdataPython |
123670 | from flask import current_app
db = current_app.db
game_user_table = db.Table(
'game_user', db.Model.metadata,
db.Column('game_id', db.Integer, db.ForeignKey('game.id')),
db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
)
class Game(db.Model):
__tablename__ = "game"
id = db.Column(db.In... | StarcoderdataPython |
151347 | <reponame>draplater/empty-parser
import dynet as dn
import nn
from logger import logger
class TriLinear(nn.DynetSaveable):
def __init__(self, model, input_dim, output_dim):
super(TriLinear, self).__init__(model)
self.output_dim = output_dim
self.input_dim = input_dim
self.w1 = sel... | StarcoderdataPython |
12952 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-27 16:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('basic', '0002_auto_20170727_1741'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1756131 | <reponame>daemon/lex
from collections import defaultdict
from typing import List
import re
from pydantic import BaseSettings
import pandas as pd
from lex.core import BotModule, IntentPredictor, Intent, AuthoredMessage, IntentSelfMentionFilterMixin, IntentPrediction,\
RegexIntentPredictor, LemmaRegexIntentPredicto... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.