id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1718996 | <reponame>lcirrott/Kratos
# makes KratosMultiphysics backward compatible with python 2.6 and 2.7
from __future__ import print_function, absolute_import, division
# Application dependent names and paths
import KratosMultiphysics as KM
from KratosStructuralMechanicsApplication import *
application = KratosStructuralMech... | StarcoderdataPython |
1729969 |
from typing import Dict
from typing import List
from typing import Union
from datetime import date
from datetime import datetime
from enum import Enum
from edgar.session import EdgarSession
from edgar.utilis import EdgarUtilities
from edgar.parser import EdgarParser
class MutualFunds():
"""
## Overview:
... | StarcoderdataPython |
1775617 | from typing import Any, Callable, Optional, TypeVar
import orjson
from pydantic import BaseModel
Schema = TypeVar("Schema", bound=BaseModel)
def orjson_dumps(v: Any, *, default: Optional[Callable[[Any], Any]] = None) -> str:
"""
orjson.dumps returns bytes, to match standard json.dumps we need to decode.
... | StarcoderdataPython |
3241034 | <gh_stars>10-100
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, mo... | StarcoderdataPython |
3339886 | import pytest
from aiohttp import web
@pytest.mark.parametrize('prefix', [''])
async def test_get(view, mocker, prefix):
m = mocker.Mock()
m.method = 'GET'
m.path = ''
m.match_info = {}
with pytest.raises(web.HTTPOk):
await view.factory(prefix=prefix)().get()
@pytest.mark.parametrize('pr... | StarcoderdataPython |
3301164 | <filename>log-analysis/markdown_helper.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/a... | StarcoderdataPython |
87209 | <filename>driver.py
from optparse import OptionParser
from SuffixTree import CreateTree
from Simple import *
import json
import gc
import progressbar
import GaleShapley as gs
import Strings
from math import exp
from ortools.graph import pywrapgraph
from termcolor import colored
"""
This module is the driver program th... | StarcoderdataPython |
1789346 | <filename>openprocurement/auction/insider/tests/unit/test_dutch_phase.py<gh_stars>0
# -*- coding: utf-8 -*-
import datetime
import dateutil.parser
import pytest
from openprocurement.auction.insider.constants import DUTCH
def test_end_stage(auction, logger, mocker):
auction.audit = {
'timeline':
... | StarcoderdataPython |
181730 | #!/usr/bin/env python
# coding: utf-8
# Write a function to which would return the greatest common of factor.
#
# <b> Input : 18, 27</b>
#
# <b> return: 9 </b>
#
#
# In[1]:
# Get the smallest of the both inputs
# Loop through the find the GCD#
def gcd(x,y):
small=min(x,y)
for i in range(1,small+1):
... | StarcoderdataPython |
3349949 | <reponame>kyldery/streamlink<filename>tests/plugins/test_tviplayer.py
from streamlink.plugins.tviplayer import TVIPlayer
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlTVIPlayer(PluginCanHandleUrl):
__plugin__ = TVIPlayer
should_match = [
"https://tviplayer.iol.pt/direto/TVI... | StarcoderdataPython |
32559 | <filename>log_task_id.py
import logging
from celery._state import get_current_task
class TaskIDFilter(logging.Filter):
"""
Adds celery contextual information to a log record, if appropriate.
https://docs.python.org/2/howto/logging-cookbook.html
#using-filters-to-impart-contextual-information
"""
... | StarcoderdataPython |
2733 | <reponame>Binary-bug/Python<filename>language/Basics/stringformatting.py<gh_stars>0
age = 24
print("My age is " + str(age) + " years ")
# the above procedure is tedious since we dont really want to include str for every number we encounter
#Method1 Replacement Fields
print("My age is {0} years ".format(age)) # {0}... | StarcoderdataPython |
3224488 | <reponame>Mikhail-Gorelov/chat_microservice<filename>web/main/models.py
from typing import NamedTuple
from uuid import uuid4
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import gettext_lazy as _
from .managers import UserManager
class User(AbstractUs... | StarcoderdataPython |
1650973 | from django.urls import path, re_path
from apps.user.views import RegisterView, LoginView, UserInfoView, UserOrderView, UserSiteView, LogOutView
from django.conf.urls import include, url
urlpatterns = [
url(r'^login$', LoginView.as_view(), name="login"),
url(r'^register$', RegisterView.as_view(), name="registe... | StarcoderdataPython |
3359663 | <filename>src/UQpy/reliability/taylor_series/baseclass/TaylorSeries.py
import logging
from abc import ABC
import numpy as np
from UQpy.transformations import *
class TaylorSeries(ABC):
@staticmethod
def _derivatives(
point_u,
runmodel_object,
nataf_object,
order="first",
... | StarcoderdataPython |
97183 | from __future__ import absolute_import, division, print_function
import argparse
import os
import os.path as op
import code
import json
import zipfile
import torch
import numpy as np
from metro.utils.metric_pampjpe import get_alignMesh
def load_pred_json(filepath):
archive = zipfile.ZipFile(filepath, 'r')
js... | StarcoderdataPython |
85379 | # Standard Library
from datetime import datetime
# 3rd Party
import croniter
import pkg_resources
from flask import Blueprint, current_app, jsonify, url_for
# Fastlane
from fastlane.models import Job, Task
from fastlane.models.categories import QueueNames
from fastlane.queue import Queue
from fastlane.utils import fr... | StarcoderdataPython |
3394709 | from django.urls import path
from .views import create_new_item, create_new_worker, list_all_items, list_all_workers, get_item, get_worker
urlpatterns = [
path('items/', list_all_items),
path('items/<str:pk>/', get_item),
path('items/new/', create_new_item),
path('workers/', list_all_workers),... | StarcoderdataPython |
23920 | from datetime import datetime
import sqlalchemy as sa
from flask_sqlalchemy import Model
from sqlalchemy import ForeignKey
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship
from app.main.extensions import db
class BaseMixin(Model):
def save_to_db(self):
try:
... | StarcoderdataPython |
1787709 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 14:19:50 2021
根据文本分类得到感兴趣的领域所在的句子,并进行领域词抽取
"""
import pandas as pd
from pandas import DataFrame
import re
import os
import csv
from collections import Counter
import numpy as np
#获得公司列表
def get_compIndex(filepath):
compDf_all = pd.read_csv(filepath)
compDf_all... | StarcoderdataPython |
3200997 | <reponame>imagirom/inferno
import torch.nn as nn
__all__ = ['AnisotropicUpsample', 'AnisotropicPool']
class AnisotropicUpsample(nn.Module):
def __init__(self, scale_factor):
super(AnisotropicUpsample, self).__init__()
self.upsampler = nn.Upsample(scale_factor=scale_factor)
def forward(self, ... | StarcoderdataPython |
3349395 | """This module contains the general information for GlInventoryEp ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class GlInventoryEpConsts():
TYPE_BOOT_MGR = "boot-mgr"
TYPE_CENTRAL_MGR = "central-mgr"
... | StarcoderdataPython |
193988 | <gh_stars>1-10
import tensorflow as tf
from model.vgg16 import VGG16
from model.rpn import RPN
from model.layer.roi_pooling_layer import roi_pooling
from model.tail import Tail
from config.config import cfg
from model.utils.bbox_transform import delta2bbox, clip_to_boundary
from tensorflow.keras.losses import sparse_ca... | StarcoderdataPython |
65580 | <reponame>danielbrunt57/zha-device-handlers<gh_stars>1-10
"""SmartThings SmartSense Motion quirk."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Ota
from ..const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTP... | StarcoderdataPython |
3380751 | import FWCore.ParameterSet.Config as cms
import copy
'''
Sequences for HPS taus that need to be rerun in order to update Monte Carlo/Data samples produced with CMSSW_7_0_x RecoTauTag tags
to the latest tau id. developments recommended by the Tau POG
authors: <NAME>, Wisconsin
<NAME>, LLR
'''
from RecoTauTa... | StarcoderdataPython |
173669 | from flask import Flask
def create_app():
"""Create and configure instance of the Flask application"""
app = Flask(__name__)
@app.route('/')
def barebones():
return 'the barebones'
return app | StarcoderdataPython |
155031 | <gh_stars>0
import sys
from itertools import permutations
from itertools import combinations
F2.<ww> = FiniteField(2)[]
F16.<alpha> = FiniteField(16, modulus= ww^4 + ww + 1, repr='int')
P2.<x,y,z> = ProjectiveSpace(F16,2)
X = Curve(x^2*z + x*z^2 - y^3 - y*z^2)
# The rational points of X except the point at infinity... | StarcoderdataPython |
181631 | import os.path
import urllib.parse
import urllib.request
from typing import List
from . import msgparts as mp
from .lib.log import warning
from .paths import TMP_PATH
from .version import SERVER_COMPATIBILITY
# old value used by some features (stats, ...)
METASERVER_URL = "http://jlpo.free.fr/soundrts/metaserver/"
M... | StarcoderdataPython |
1665982 | <reponame>yoyowallet/yoflow
from django.apps import AppConfig
class YoflowConfig(AppConfig):
name = 'yoflow'
| StarcoderdataPython |
3391209 | <gh_stars>1-10
from werkzeug.test import Client
from werkzeug.testapp import test_app
import sockjs_flask
def test_sockjs_route_info():
sockjs_route = sockjs_flask.SockJSRoute(
'test', '', 'https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.4/sockjs.js', (), (), debug=True)
assert type(sockjs_r... | StarcoderdataPython |
182135 | from enum import Enum
class ErrorEnum(Enum):
InvalidLogin = 10
| StarcoderdataPython |
4814378 | matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
somapar = somacol = maior = 0
for linha in range(0,3):
for coluna in range(0,3):
matriz[linha][coluna] = int(input(f"Digite um valor para [{linha}][{coluna}]: "))
for linha in range(0,3):
for coluna in range(0,3):
print(f"[{matriz[linha][coluna]:^5}]",... | StarcoderdataPython |
4392 | #!/usr/bin/env python
# Converts a PoD XML file to a GeoJSON file.
#
# With the --javascript parameter, the generated file is a javascript
# file defining a variable 'basePodSpec'.
#
# Get the PoD XML file from http://dev.24-timmars.nu/PoD/xmlapi_app.php.
import xml.etree.ElementTree as etree
import argparse
import r... | StarcoderdataPython |
3222665 | <gh_stars>1-10
import re
from pathlib import Path
from subprocess import check_output
import click
import git
from typing import Optional
import neovim
LINE_RE = re.compile(r'^(?:\w+)\s+([0-9a-f]+)\s')
@click.command()
@click.argument('bufnr')
@click.argument('commitsha')
def main(bufnr, commitsha):
nvim = neo... | StarcoderdataPython |
112600 | <filename>cmsplugin_gridlayout/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-24 06:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependen... | StarcoderdataPython |
1671540 | <reponame>skg44444/Red
from . import Log
from . import Application
def main():
EngineLog = Log.logger("Engine")
app = Application.Application()
app.run()
del app
EngineLog.info("Exiting Main function")
if __name__ == "__main__":
main() | StarcoderdataPython |
3223182 | <gh_stars>0
import re, time, sys
from selenium import webdriver
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup
from bs4 import element
'''
This class is meant to be used with Jobbing GUI.
This can scrape a well-structured website by
looking for known equally structured data as
compared to a ... | StarcoderdataPython |
1701581 | <reponame>JPLOpenSource/fprime-sw-Rel1.0
import sys
import ThreadedTCPServer
if __name__ == "__main__":
ThreadedTCPServer.main(sys.argv)
| StarcoderdataPython |
152281 | #!/usr/bin/python3
# vim: ts=4 expandtab
# SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-2-Clause
| StarcoderdataPython |
3336144 | <gh_stars>1-10
from django.views.generic import View
from django.shortcuts import render
from items.models import ItemPost
from django.core.paginator import InvalidPage, Paginator
from haystack.views import SearchView
"""
django-haystack code
link - https://github.com/django-haystack/django-haystack/blob/master/hayst... | StarcoderdataPython |
189295 | <reponame>jiaqinz/django-guacamole<filename>guacamole-bak/net/InetGuacamoleSocket.py<gh_stars>10-100
import logging
import socket
from GuacamoleSocket import GuacamoleSocket
from guacamole.exceptions import GuacamoleUpstreamTimeoutException, GuacamoleServerException
from guacamole.io.ReaderGuacamoleReader import Read... | StarcoderdataPython |
3380692 | version = '0.4'
release = False
| StarcoderdataPython |
3362428 | import pandas as pd
import numpy as np
import math
import sklearn.datasets
import ipywidgets as widgets
##Seaborn for fancy plots.
#%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
plt.rcParams["figure.figsize"] = (8,8)
def sklearn_to_df(sklearn_dataset):
df = pd.DataFrame(sklearn_dataset... | StarcoderdataPython |
1670693 | def permutations(string):
perms = []
# print(string)
for i in enumerate(string):
# print(i)
if i[0] == 0:
perms.append(i[1])
continue
# print(perms)
for j in perms:
curr = []
print(i, j, curr)
for k in range(len(j)... | StarcoderdataPython |
1689973 | <gh_stars>1-10
import math, string, sys, fileinput
def range_bytes(): return range(256)
def range_printable(): return (ord(c) for c in string.printable)
def H(data, iterator=range_bytes):
if not data:
return 0
entropy = 0
for x in iterator():
p_x = float(data.count(chr(x)))/len(data)
... | StarcoderdataPython |
3379988 | import argparse
from tdw.controller import Controller
from tdw.remote_build_launcher import RemoteBuildLauncher
class MinimalRemote(Controller):
"""
A minimal example of how to use the launch binaries daemon to
start and connect to a build on a remote node. Note: the remote
must be running binary_mana... | StarcoderdataPython |
1646909 | from .fractals import Mandelbrot
| StarcoderdataPython |
1796635 | <reponame>kimoamer/Clinic-Manager
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QWidget
from patlist import Ui_Form as patlis
class listwidget(QWidget, patlis):
def __init__(self):
super(listwidget, self).__init__()
QWidget.__init__(self)
self.setupUi(self)
font... | StarcoderdataPython |
84018 | import pytest
import numpy as np
from mindspore import ops, Tensor, context
from mindspore.common.parameter import Parameter
from mindspore.nn import Cell
class AssignNet(Cell):
def __init__(self, input_variable):
super(AssignNet, self).__init__()
self.op = ops.Assign()
self.input_data = i... | StarcoderdataPython |
32317 | from __future__ import absolute_import, print_function, unicode_literals
import unittest
from doozerlib import distgit
class TestDistgitConvertSourceURLToHTTPS(unittest.TestCase):
def test_conversion_from_ssh_source(self):
source = "git@github.com:myorg/myproject.git"
actual = distgit.convert_so... | StarcoderdataPython |
1646569 | # Generated by Django 2.2.17 on 2020-11-20 23:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pokemongo", "0041_auto_20201120_1919"),
]
operations = [
migrations.AlterField(
model_name="update",
name="badge_po... | StarcoderdataPython |
4811139 | <reponame>Awesome-Logic/ballistica
# Copyright (c) 2011-2020 <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, co... | StarcoderdataPython |
3308028 | #Import basic modules
import os
#Import the main window object (mw) from aqt
from aqt import mw
#Import the "show info" tool from utils.py
from aqt.utils import showInfo
#Import all of the Qt GUI library
from aqt.qt import *
#Import local .py modules
from . import Utils, MainWindow
echo = Utils.echo
#This is the f... | StarcoderdataPython |
64708 | <filename>setup.py
from setuptools import setup
setup(name='nxempowerment',
version='0.1',
description='Compute Empowerment for NetworkX graphs',
url='https://github.com/marcus-clements/nxempowerment',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['nxempowe... | StarcoderdataPython |
3383807 | <reponame>tendai-zw/followthemoney
import json
from followthemoney.util import get_entity_id
from followthemoney.namespace import Namespace
class Recon(object):
MATCH = 't'
DISTINCT = 'f'
UNSURE = '?'
__slots__ = ['subject', 'canonical', 'judgement']
def __init__(self, subject, canonical, judgem... | StarcoderdataPython |
4824063 | <filename>Scripts5/Script39.py<gh_stars>1-10
'''Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com sua idade, se ele ainda vai se alistar ao serviço militar, se é a hora de se alistar ou se já passou do tempo de alistamento. Seu programa também deverá mostrar o tempo que falta ou que pas... | StarcoderdataPython |
134783 | from __main__ import sio
''' Events handlers for Join room and leave room ,
This method contains join room and leave room for all name spaces. This was introduced to ensure join room and leave
room happens within the namespace'''
@sio.on('join_room', namespace='/project')
async def join_room(sid, room_name):
pri... | StarcoderdataPython |
103920 | import networkzero as nw0
address = nw0.advertise("myservice3", 1234)
print("Service is at address", address) | StarcoderdataPython |
107602 | from django.contrib import admin
from .models import *
admin.site.register(BudgetAccount)
admin.site.register(UserBudget)
admin.site.register(Envelope)
admin.site.register(Transaction)
admin.site.register(ScheduledTransaction)
admin.site.register(SavingsHistory)
| StarcoderdataPython |
3315596 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Message(models.Model):
name = models.CharField(max_length=30)
subject = models.CharField(max_length=30)
body = models.TextField()
| StarcoderdataPython |
3203946 | <reponame>keNEticHEx/assemblyline-ui<filename>assemblyline_ui/security/apikey_auth.py<gh_stars>0
from assemblyline_ui.config import config
from assemblyline.common.security import verify_password
from assemblyline_ui.http_exceptions import AuthenticationException
def validate_apikey(username, apikey, storage):
# ... | StarcoderdataPython |
3253817 | <filename>EjemplosCodigo/40_ReadCSV.py
import csv
print("---------------------EJEMPLO 1----------------------")
# Separado por , y queremos convertirlo a lista
with open('workers.txt','r') as csvFile:
reader = csv.reader(csvFile)
for row in reader:
print(row)
csvFile.close()
print("--------------... | StarcoderdataPython |
1768822 | # coding:utf-8
from ..base import ComponentAPI
class CollectionsDiskUsage(object):
"""Collections of Disk Usage APIS"""
def __init__(self, client):
self.client = client
self.get_disk_usage = ComponentAPI(
client=self.client, method='GET',
path='/api/c/self-service-ap... | StarcoderdataPython |
14064 | <filename>example/example.py<gh_stars>0
from htmlparser import HTMLParser
import pandas
# Here we scrap a page from Wikipedia, parse it for tables, and convert the first table found into a `pandas.DataFrame`.
url = "https://en.wikipedia.org/wiki/List_of_S%26P_500_companies"
hp = HTMLParser(url)
# scrapping the webpage... | StarcoderdataPython |
3392510 | <gh_stars>0
import click
import asyncio
from ghia.common import GHIA, PrinterObserver, get_token, get_rules
from ghia.Helpers import Parser
@click.command('ghia')
@click.argument('reposlug', type=click.STRING, callback=Parser.parse_reposlug)
@click.option('-s', '--strategy', default=GHIA.DEFAULT_STRATEGY,
... | StarcoderdataPython |
62603 | <reponame>Westlake-AI/openmixup<gh_stars>1-10
import random
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn.functional as F
from openmixup.utils import force_fp32, print_log
from openmixup.models.utils import Canny, Laplacian, Sobel
from .base_model import BaseModel
from .. import ... | StarcoderdataPython |
81632 | <filename>main.py
# imports...
import qrcode
from PIL import Image
from flask import Flask, request, render_template, redirect
from flask_cors import cross_origin
import base64
import io
app = Flask(__name__)
@app.route("/")
@cross_origin()
def home():
return render_template("home.html")
@app.rout... | StarcoderdataPython |
39504 | <filename>det.py<gh_stars>1-10
import asyncio
from argparse import ArgumentParser
from mmdet.apis import (async_inference_detector, inference_detector,
init_detector, show_result_pyplot)
from mmcv.runner import wrap_fp16_model
import cv2
import numpy as np
from tqdm import tqdm
import os
impor... | StarcoderdataPython |
3313800 | <gh_stars>1-10
#!/usr/bin/python2.7
import os
import time
def getLastModified(path):
dirname = os.path.dirname(path)
src = ""
last = None
for d in os.listdir(path):
tmp = os.path.getmtime(os.path.join(dirname, d))
if last is None:
last = tmp
src = d
else:... | StarcoderdataPython |
51061 | from math import sqrt
from numpy import *
import numpy as np
import sys
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import NMF
from sklearn.decomposition import PCA
from sklearn.decomposition import TruncatedSVD
from ... | StarcoderdataPython |
1629910 | <reponame>easywaytostudy123/mini-project
"""Project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path... | StarcoderdataPython |
3351371 | <reponame>dannypadilla/vcontrol
from ..helpers import get_allowed
import subprocess
import web
class HeartbeatMachinesR:
"""
This endpoint is just a quick way to ensure that Vent machines are still
reachable.
"""
allow_origin, rest_url = get_allowed.get_allowed()
def GET(self):
out = "... | StarcoderdataPython |
3275647 | <reponame>ramupreetham/neutron
# Copyright 2019 Kaloom, Inc. 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.... | StarcoderdataPython |
4809756 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | StarcoderdataPython |
3256104 | <reponame>Xamaneone/Django-Projects<gh_stars>0
from django.urls import path
from python_web_framework_project_defense.extended_user_auth.views import register, log_in, log_out
urlpatterns = (
path('register/', register, name='register'),
path('login/', log_in, name='login'),
path('logout/', log_out, name=... | StarcoderdataPython |
4802482 | <filename>main.py
import logging
import urllib.request, urllib.parse, urllib.error
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import Extensi... | StarcoderdataPython |
47584 | import tenjin
from tenjin.helpers import *
import cgi
engine = tenjin.Engine(path=['views'], escapefunc="cgi.escape", tostrfunc="str")
print(engine.get_template('page.pyhtml').script)
| StarcoderdataPython |
3363529 | <reponame>dolio/TemplePlus
from toee import *
def OnBeginSpellCast(spell):
print "Focusing Chant OnBeginSpellCast"
print "spell.spellTarget_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
def OnSpellEffect(spell):
print "Focusing Chant OnSpellEffect... | StarcoderdataPython |
3337020 | from smtplib import SMTP as smtp
from email.mime.text import MIMEText
from canary_log_api.models import CanaryLogItem
from manage_api.models import Trigger, SMTPSetting
class SMTP():
"""Class responsible for sending SMTP messages (email)."""
def __init__(self):
"""Initialize class with settings from... | StarcoderdataPython |
3360699 | <reponame>deepmipt/dp-agent
import asyncio
from collections import defaultdict
from importlib import import_module
from typing import Dict
import aiohttp
from .core.connectors import (AgentGatewayToServiceConnector,
AioQueueConnector, HTTPConnector,
QueueLis... | StarcoderdataPython |
3375558 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from flask import request
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
CACHE_DEFAULT_TIMEOUT = None
CACHE_CONFIG = {"CACHE_TYPE": "simple"}
APP_ENV... | StarcoderdataPython |
116665 | <gh_stars>0
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: quantra
class FlowType(object):
Interest = 0
PastInterest = 1
Notional = 2
| StarcoderdataPython |
3210546 | import torch
from torch import nn
from torch.nn import init
from torchdiffeq.tmp.odeint import odeint_rk4error
from torchdiffeq import odeint
feat_dim = 4
num_step = 10
class TmpFunc(nn.Module):
def __init__(self, feat_dim):
super(TmpFunc, self).__init__()
self.linear = nn.Linear(in_features=feat_... | StarcoderdataPython |
1736950 | from django.db import models
from django.contrib.auth.models import AbstractUser
from datetime import date
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from dateutil.relativedelta import relativedelta
from django.core.validators import FileExtensionValidator
from django.conf... | StarcoderdataPython |
1749826 | <filename>car_speech/pipeline.py
# AUTOGENERATED! DO NOT EDIT! File to edit: 04_Pipeline.ipynb (unless otherwise specified).
__all__ = ['shuffle_data', 'train_test_split', 'decode_audio', 'get_label', 'get_waveform_and_label', 'get_spectrogram',
'get_spectrogram_and_label_id_digits', 'get_spectrogram_and_la... | StarcoderdataPython |
1712009 | # -*- coding: utf-8 -*-
u"""Lattice utilities.
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdc, pkdl... | StarcoderdataPython |
3315508 | #!/usr/bin/env python
#
# enums
# v0.1
#
# <NAME> (<EMAIL>)
# October 2016
#
# This class provides some enumerations that are
# used for this project.
#
# REQUIREMENTS:
# - None
#
# WARNING:
# Any use of these scripts and tools is at
# your own risk. There is no... | StarcoderdataPython |
3373534 | <gh_stars>0
from mock import patch, Mock
from unittest import TestCase
import json
import logging
import time
from restapi_logging_handler import LogglyHandler
class _BaseLogglyHandler(TestCase):
tags = ['tag1', 'tag2']
@classmethod
@patch('restapi_logging_handler.restapi_logging_handler.FuturesSession'... | StarcoderdataPython |
189135 | import config
from slackclient import SlackClient
class reactionCounterPlugin:
def __init__(self):
self.keywords = ['!rankings', '!Rankings', '!ranking', '!Ranking', 'reactionBased']
self.client = SlackClient(config.bot_token)
self.db = config.mongoClient
def execute(self, event):
... | StarcoderdataPython |
3272141 | import threading
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import utils as oslo_db_utils
from oslo_log import log
from oslo_utils import uuidutils
from nca47.common import exception
from nca47.db import api
from nca47.api.controllers.v1 import tools
from oslo_serialization import j... | StarcoderdataPython |
3233605 | <gh_stars>0
import sqlite3
conn = sqlite3.connect('demo_data.sqlite3')
curs = conn.cursor()
# Create demo table and insert data
curs.execute('''CREATE TABLE demo (
s varchar(10),
x int,
y int
);''')
curs.execute('''INSERT INTO demo (s, x, y) VALUES ('g', 3, 9);''')
curs.execute('''INSERT INTO demo (s, x, ... | StarcoderdataPython |
1648437 | import logging
import pathlib
import pickle
from collections import defaultdict
from typing import Any, Dict, List
from bokeh.document.document import Document
from bokeh.models import Div, MultiChoice, Panel
from nuplan.planning.metrics.metric_file import MetricFile
from nuplan.planning.nuboard.base.data_class import... | StarcoderdataPython |
4816556 | <filename>hs_app_netCDF/serialization.py
import xml.sax
import rdflib
from django.db import transaction
from hs_core.serialization import GenericResourceMeta
class NetcdfResourceMeta(GenericResourceMeta):
"""
Lightweight class for representing metadata of NetcdfResource instances.
"""
def __init__(... | StarcoderdataPython |
3380925 | <reponame>Nicersmeng/secure-xgboost<filename>demo/python/remote-control/orchestrator/start_orchestrator.py
import securexgboost as xgb
import os
HOME_DIR = os.path.dirname(os.path.realpath(__file__)) + "/../../../../"
xgb.serve(all_users=["user1"], nodes=["127.0.0.1"], port=50052)
| StarcoderdataPython |
1646441 | from django.apps import AppConfig
class MysiteConfig(AppConfig):
name = 'mysite'
verbose_name = "Mysite"
def ready(self):
import mysite.signals
pass
| StarcoderdataPython |
1604103 | # -*- coding: utf-8 -*-
# Description: nginx log netdata python.d module
# Author: <NAME> (paulfantom)
from base import LogService
import re
priority = 60000
retries = 60
# update_every = 3
ORDER = ['codes']
CHARTS = {
'codes': {
'options': [None, 'nginx status codes', 'requests/s', 'requests', 'nginx_lo... | StarcoderdataPython |
5195 | # cython: language_level=3
# -*- coding: utf-8 -*-
from mathics.core.expression import Expression
from mathics.core.symbols import Atom, Symbol
from mathics.core.atoms import Integer
from mathics.builtin.base import MessageException
"""
This module provides some infrastructure to deal with SubExpressions.
"""
def... | StarcoderdataPython |
105115 | #!/usr/bin/env python
"""Analyze how important a Unicode block is for the different languages."""
# core modules
import logging
# 3rd party modules
import click
import numpy as np
# internal modules
from lidtk.data import wili
@click.command(name='analyze-unicode-block', help=__doc__)
@click.option('--start', de... | StarcoderdataPython |
3274290 | <filename>batch-update-top-containers.py
import os, json, csv, datetime
import asnake.logging as logging
# This file performs batch updates to top container records, adding locations. The API expects to add a single location to every top container which is in that location. It expects a two-column CSV with columns 'lo... | StarcoderdataPython |
4809920 | from django.utils import timezone
from projects.models import Project
def get_used_sus(charge):
now = timezone.now()
actual_end_time = charge.end_time
if charge.start_time > now:
# not started yet
return 0.0
if not actual_end_time or actual_end_time > now:
# ongoing charge
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.