id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3323584 | <reponame>sikawit/find_ocsc_username
import requests
from bs4 import BeautifulSoup
from urllib.request import urlopen
import pandas as pd
import time
def find_path():
n_start = int(input("n_start >>> "))
n_stop = int(input("n_stop >>> "))
t0 = time.time()
url_main = "http://ocsc.chulaonline.net/... | StarcoderdataPython |
95182 | # vim:fileencoding=utf-8:ts=2:sw=2:expandtab
'''
A DocStruct_Release table in the schema
Every time we do an upgrade, we'll replace the column in this table with the correct version number.
ALTER TABLE DocStruct_Release RENAME 1.0.1 TO 1.0.2 ... this will fail if you are out of sync.
'''
from .Client import Cli... | StarcoderdataPython |
1725315 | <gh_stars>1-10
# -*- coding: utf-8 -*-
'''
############################
Acme::MetaSyntactic::pokemon
############################
****
NAME
****
Acme::MetaSyntactic::pokemon - The Pokmon theme
***********
DESCRIPTION
***********
List of the 802 Pokmon characters that are officially known to exist
in the franchi... | StarcoderdataPython |
111355 | <reponame>aggregate1166877/glassfs
#!/usr/bin/env python
# Usage example:
# python glass_fs.py /your/dir /mnt/point
# See also:
# https://www.thepythoncorner.com/2017/02/writing-a-fuse-filesystem-in-python/?doing_wp_cron=1562559777.6591670513153076171875
from __future__ import with_statement
import os
import sys
im... | StarcoderdataPython |
1685466 | <reponame>Vicky-Rathod/django-blog<filename>likes/urls.py
from django.urls import path
from .views import PostLikeView, PostDisLikeView
app_name = 'likes'
urlpatterns = [
path('like/', PostLikeView.as_view(), name='post_like'),
path('dislike/', PostDisLikeView.as_view(), name='post_dislike')
]
| StarcoderdataPython |
1710748 | from django_gearman_proxy.tests.serializers.mail.test_json import *
from django_gearman_proxy.tests.serializers.sms.test_json import *
from django_gearman_proxy.tests.backends.test_mail import *
from django_gearman_proxy.tests.backends.test_sms import *
from django_gearman_proxy.tests.management.commands.test_send_ma... | StarcoderdataPython |
72228 | import os
import glob
from terminaltables import AsciiTable
import json
from datetime import datetime
import time
class Pjobs():
def __init__(self, jobsdir):
pendloc = os.path.join(jobsdir, 'PEND')
runloc = os.path.join(jobsdir, 'RUN')
self.pendFiles = glob.glob("%s/*.json" % pendloc)
... | StarcoderdataPython |
39546 | import glob
import os
# os.environ["IMAGEIO_FFMPEG_EXE"] = "C:/ffmpeg-4.4.1-essentials_build/ffmpeg-4.4.1-essentials_build/bin"
import re
import sys
import urllib
from tkinter import (BOTH, RIGHT, YES, Button, Entry, Label, Listbox, Menu,
Scrollbar, StringVar, Tk, Y)
from tkinter import messagebox ... | StarcoderdataPython |
1725828 | from typing import Iterable
import torch
import torch.nn as nn
from lgp.models.alfred.voxel_grid import VoxelGrid
from lgp.models.alfred.projection.projection_ops import project_3d_camera_points_to_2d_pixels, project_3d_points, scatter_add_and_pool
from lgp.models.alfred.projection.image_to_pointcloud import ImageToP... | StarcoderdataPython |
126461 | <reponame>hdm-dt-fb/ironpython-stubs<filename>stubs.min/System/Windows/__init___parts/ContentElement.py
class ContentElement(DependencyObject,IInputElement,IAnimatable):
"""
Provides a WPF core-level base class for content elements. Content elements are designed for flow-style presentation,using an intuitive markup... | StarcoderdataPython |
1704680 | <gh_stars>0
from django.db import models
from django.core.files.base import ContentFile
from django.utils import timezone
from django.conf import settings
# info on remote/local storage
#https://docs.djangoproject.com/en/dev/topics/files/
# Create your models here.
class Model(models.Model):
timestamp = timezo... | StarcoderdataPython |
3285209 | import os
import ast
import glob
import numpy as np
import pandas as pd
from tqdm import tqdm
from itertools import chain
from astropy.io import ascii
import multiprocessing as mp
from astropy.stats import mad_std
from astropy.timeseries import LombScargle as lomb
from pysyd import __file__
from pysyd.plots import set... | StarcoderdataPython |
3368596 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(C) Copyright [2014] InfoSec Consulting, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requir... | StarcoderdataPython |
4811441 | from malcolm.yamlutil import check_yaml_names, make_block_creator
profiling_web_server_block = make_block_creator(
__file__, "profiling_web_server_block.yaml"
)
__all__ = check_yaml_names(globals())
| StarcoderdataPython |
62720 | <gh_stars>0
from watchlist import app
'''
from flask import Flask,url_for,render_template,request,flash,redirect # 引入Flask类 ,url_for反向解析
from faker import Factory # 使用faker生成测试数据
from settings import DebugMode,TestingMode # 设置模式
from flask_sqlalchemy import SQLAlchemy # 数据库扩展
from werkzeug.security import genera... | StarcoderdataPython |
179158 | import numpy as np
import cv2
# Load an color image in grayscale
img = cv2.imread('/home/pankaj/Downloads/home.jpg',0)
WINDOW_NAME = 'Image'
cv2.namedWindow(WINDOW_NAME)
cv2.startWindowThread()
# Display an image
cv2.imshow(WINDOW_NAME,img)
cv2.waitKey(0)
cv2.destroyWindow(WINDOW_NAME)
| StarcoderdataPython |
3293389 | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from viewflow.models import Process, Task
class Carrier(models.Model):
DEFAULT = 'Default'
name = models.CharField(max_length=50)
phone = models.CharField(max_length=15)
... | StarcoderdataPython |
118827 | <reponame>simonpf/bunny_lab<filename>bunny_lab/names.py
import numpy as np
import os
import random
current_dir = os.path.dirname(__file__)
path = os.path.join(current_dir, "bunny_names.txt")
names = open(path).read().split(",")
names = [n.strip() for n in names]
def get_random_name():
"""
Returns a random bun... | StarcoderdataPython |
118370 | from typing import Mapping
import meerkat as mk
from dcbench.common import Problem, Solution
from dcbench.common.artifact import (
DataPanelArtifact,
ModelArtifact,
VisionDatasetArtifact,
)
from dcbench.common.artifact_container import ArtifactSpec
from dcbench.common.table import AttributeSpec
class S... | StarcoderdataPython |
3362080 | <reponame>guillp/jwskate
"""This module implement base classes used by Signature, Encryption and Key Management JWA algorithms."""
from contextlib import contextmanager
from typing import Generic, Iterator, Optional, Tuple, Type, TypeVar, Union
from binapy import BinaPy
class PrivateKeyRequired(AttributeError):
... | StarcoderdataPython |
3353024 | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | StarcoderdataPython |
133403 | import copy
import json
from collections import defaultdict
from jsonschema import ValidationError
from trapi_model.base import TrapiBaseClass
from trapi_model.biolink.constants import get_biolink_entity
from trapi_model.exceptions import *
from reasoner_validator import validate
def merge_meta_knowledge_graphs(list... | StarcoderdataPython |
4837759 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | StarcoderdataPython |
115190 | <reponame>jtraver/dev<filename>python3/glob/glob1.py
#!/usr/bin/env python3
import glob
def main():
pyfiles = glob.glob("../*/*.py")
for pyfile in pyfiles:
print(("pyfile %s" % pyfile))
main()
| StarcoderdataPython |
3305223 | <reponame>JonathanFromm/HackerspaceTemplatePackage
# Generated by Django 3.0 on 2019-12-11 13:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hackerspace', '0004_auto_20191210_2102'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
4832447 | import re
import xml.etree.ElementTree as ET
import logging
import datetime, time
import requests
import traceback
from StringIO import StringIO
from PIL import Image, ImageDraw, ImageFont
from collections import OrderedDict
from sqlalchemy import inspect
from flask import current_app
from emonitor.extensions import ev... | StarcoderdataPython |
62237 | <reponame>ComtecSystem-dev/Python_DB_Pool<filename>Demo/cims_db.py<gh_stars>0
# -*- coding: utf-8 -*-
################################################################################
# _____ _ #
# / ____ | | ... | StarcoderdataPython |
3357334 | from collections import defaultdict
import httpx
from bs4 import BeautifulSoup
from unidecode import unidecode
URL = 'http://www.fundamentus.com.br/resultado.php'
HEADERS = {'User-Agent': 'Mozilla/5.0'}
PARAMS = {
'pl_min': '',
'pl_max': '',
'pvp_min': '',
'pvp_max': '',
'psr_min': '',
'psr_ma... | StarcoderdataPython |
3320513 | from PyQt5.QtWidgets import QGroupBox, QLayout, QHBoxLayout, QVBoxLayout, QGridLayout
class GroupWidget(QGroupBox):
""" `QGroupBox <https://doc.qt.io/qt-5/qgroupbox.html>`_ with a layout automatically set.
Parameters
----------
layout : {"vbox", "hbox", "grid", QLayout}
Typ... | StarcoderdataPython |
1609834 | # coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | StarcoderdataPython |
1669521 | import re
from typing import Union, Callable, Iterable
def str_chain_apply(
input_str: str, ordered_transformers: Iterable[Callable[[str], str]]
) -> str:
"""Apply set of functions in order - pipeline-like"""
result = input_str
for t in ordered_transformers:
result = t(result)
return resul... | StarcoderdataPython |
4817065 | <filename>examples/DataEstimatesRiskModel.py
#!/usr/bin/env python
# coding: utf-8
# In[16]:
from __future__ import print_function
import pandas as pd
import numpy as np
import datetime as dt
import collections
import quandl
# quandl.ApiConfig.api_key = '<KEY>'
# # Data
# In[5]:
datadir='../data/'
assets=pd.re... | StarcoderdataPython |
4807816 | '''
Django settings for lions_md project.
Copyright (c) 2011, <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:
Redistributions of source code must retain the above copyright
notice, this list ... | StarcoderdataPython |
3211637 | <reponame>dcordb/DSpotify
# debugging small case (if True hash of songs is name of the song
# please note that in this case NAME OF SONG MUST BE INTEGER,
# else is big hash)
DEBUG_MODE = True
# log of SIZE of DHT, if not DEBUG MODE you should put 160 one common choice is 160 (using each node SHA1 encryption)
LOG_LEN =... | StarcoderdataPython |
169384 | import json
import maya
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
days = {
0:'monday',
1:'tuesday',
2:'wednesday',
3:'thursday',
4:'friday',
5:'saturday',
6:'sunday'
}
NEWLINE = '\n'
SPACE = ' '
COLON = ':'
def day(t):
# where t means unformatted time
... | StarcoderdataPython |
1793764 | <gh_stars>0
from deepobs import analyzer
import json
import matplotlib.pyplot as plt
import matplotlib as mpl
import tikzplotlib
import codecs
# get the plot
fig, axess = analyzer.plot_testset_performances('./results/', mode = 'final')
axess[0][0].set_title("DeepOBS init")
axess[0][1].set_title("PyTorch default ini... | StarcoderdataPython |
3331706 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 29 10:48:59 2017
@author: nia00
"""
from astropy.io import fits
import matplotlib.pyplot as plt
import numpy as np
import os
def ar_temp_finder(line_ratio):
os.chdir('c:/Users/ivan/OneDrive/Research/ar_OES/DATA')
def find_nearest(array, value):
... | StarcoderdataPython |
1711531 | <filename>src/pycldf/commands/dumpdb.py
"""
Dump the contents of a SQLite DB according to the metadata of a dataset.
This allows adding data (i.e. rows) to a dataset within SQLite - maintaining schema
compatibility via the dataset metadata kept outside.
"""
from pycldf.cli_util import add_database, get_database, PathT... | StarcoderdataPython |
4809896 | from django.apps import AppConfig
class ProductStockConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'product_management_models.product_stocks'
verbose_name = 'Product Stocks'
| StarcoderdataPython |
3232925 | from .parser import CurlParser
from collections import OrderedDict
import json
from six.moves import http_cookies as Cookie
from cookielib import MozillaCookieJar as CookieJar
import shlex
import os, re
import requests
# Create a parser object for the curl statement
parser = CurlParser()
def call(curl_command):
... | StarcoderdataPython |
3328807 | <filename>_meta/snippet_creator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create snippets based on a template.
For example, once you create a snippet that will filter adversaries, you can easily create copies of that snippet for all of the other group types. This script is code, to write code (snippets), to ... | StarcoderdataPython |
135615 | # -*- coding: utf-8 -*-
import cv2
import numpy as np
import sys
def packagedWarpPerspective(f, u0, v0, a, b, c, w, h):
m31 = 0 - a
m32 = 0 - b
m33 = f + a * (w/2 + u0) + b * (h/2 + v0)
m11 = c - w / 2 * a
m12 = 0 - w / 2 * b
m13 = w / 2 * m33 - c * (w/2 + u0)
m21 = 0 - h / 2 * a
m22 = ... | StarcoderdataPython |
194909 | <reponame>Felixver/ibanity-python
from collections import namedtuple
from ibanity import Ibanity
from ibanity.Flatten import flatten_json
def get_list(financial_institution_id, financial_institution_user_id, financial_institution_account_id, params={}):
uri = Ibanity.client.api_schema["sandbox"]["financialInstitu... | StarcoderdataPython |
3369601 | # type: ignore
from invoke import call, task
SOURCES = "cli_ui"
@task
def black(c, check=False):
print("Running black")
cmd = f"black {SOURCES}"
if check:
cmd += " --check"
c.run(cmd)
@task
def isort(c, check=False):
print("Running isort")
cmd = f"isort {SOURCES}"
if check:
... | StarcoderdataPython |
1647962 | # setup of sphinx plugin
from sphinx_hwt.sphinx_hwt import setup
| StarcoderdataPython |
4817753 | from tests import Asset
correct_asset = {
"type": "aws_s3_bucket",
"id": "arn:aws:s3:::sample-id-model",
"display_name": "Bucket: Sample ID",
"link": "https://localhost.com",
"metadata": {
"aws_s3_bucket_name": {
"priority": 50,
"value": "sample-id"
... | StarcoderdataPython |
57611 | import urllib.request
import re
def getHtml(url):
page = urllib.request.urlopen(url)
html = page.read()
return html
def getImg(html):
reg = r'src="(.+?\.jpg)" pic_ext'
imgre = re.compile(reg)
html = html.decode('utf-8')
imglist = re.findall(imgre,html)
x = 0
... | StarcoderdataPython |
31078 | <reponame>PeterStuck/teacher-app
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from .vulcan_webdriver import VulcanWebdriver
class VulcanAgent:
""" Class to perform actions on Vulcan Uonet page """
def __init__(self, credentials: dict, vulcan_data = None):
sel... | StarcoderdataPython |
145140 | <gh_stars>1-10
import random
import warnings
import numpy as np
from nose.tools import raises, assert_not_equal
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal, assert_almost_equal
... | StarcoderdataPython |
71268 | <gh_stars>1-10
from argparse import ArgumentParser
from googlesearch import search
import os
# try:
# links=search("site:github.com scrapy",num=45)
# for link in links:
# print(link)
# except:
# print("Search Error")
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument(... | StarcoderdataPython |
50427 | import sys
import os
import timeit
from global_vars import *
def common_process(file, fnc, isFile):
try:
if file != None and os.path.exists(file):
select = input("FILE is already exist. Press 'Y' if you want to rewrite. ")
if select != 'Y':
print("Execution aborted..")
... | StarcoderdataPython |
64464 | <reponame>cariaso/bcbio-nextgen-vm<filename>bcbiovm/gcp/__init__.py
"""Functionality to interact with Google Cloud Platform.
"""
| StarcoderdataPython |
162473 | '''
Description: exercise: your age
Version: 1.0.0.20210113
Author: <NAME>
Date: 2021-01-13 09:44:34
Last Editors: <NAME>
LastEditTime: 2021-01-13 10:27:55
'''
def check_age(age: int) -> None:
'''
Check an age and print what he/she can do regarding the age.
Parameters
----------
age : his/her age ... | StarcoderdataPython |
3288488 | # 1
# Questa domanda richiede di analizzare il grafo delle citazioni di 27770 articoli di fisica delle alte energie.
# Il grafo ha 352807 archi ed è contenuto nel file allegato. Ogni articolo del dataset è identificato da un numero.
# Ogni riga del file contiene un arco del grafo dove il primo numero è la coda ed il se... | StarcoderdataPython |
48794 | <gh_stars>10-100
import shlex
import subprocess
import sys
import traceback
from logging import getLogger
from typing import *
logger = getLogger(__name__)
def _prepare_hook(*, data: Dict[str, Any]) -> None:
data['hook'] = []
def register_filter_command(command: List[str], *, data: Dict[str, Any]) -> None:
... | StarcoderdataPython |
1709664 | import os
import setuptools
# currentdir = os.getcwd()
with open("README.rst", "r", encoding="utf-8") as f:
long_desc = f.read()
with open("LICENSE", "r", encoding="utf-8") as f:
license_str = f.read()
setuptools.setup(
name="edigital",
version="0.1",
author='<NAME>',
python_requires='>=3.5... | StarcoderdataPython |
1739130 | <reponame>Yannig/mitogen
"""
Measure latency of local RPC.
"""
import mitogen
import time
def do_nothing():
pass
@mitogen.main()
def main(router):
f = router.fork()
t0 = time.time()
for x in xrange(10000):
f.call(do_nothing)
print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec'
| StarcoderdataPython |
1743693 | <gh_stars>0
import pytest
import json
from unilyze import Unichar
TEST_CHAR = "Ä"
u = Unichar()
def load_json(filename):
with open(filename, "r", encoding="utf-8") as fp:
data = fp.read()
return data
def create_tests():
u = Unichar()
raw_info = u.ucd_info_short(TEST_CHAR)
with open("te... | StarcoderdataPython |
3333752 | <filename>cogs/error_handler.py
import traceback
import sys
from discord.ext import commands
import discord
class CommandErrorHandler:
def __init__(self, bot):
self.bot = bot
async def on_command_error(self, ctx, error):
"""The event triggered when an error is raised while invoking a command.... | StarcoderdataPython |
1662177 | <filename>notebooks/preprocessing.py<gh_stars>10-100
#!/usr/bin/env python
# coding: utf-8
# # Example Preprocessing Flow
# - Calculate the target as % change between sucessive raw 'close' values
# - Calculate moving averages (feature engineering)
# - Represent the input X as a time series (data_to_supervised function... | StarcoderdataPython |
58682 | <reponame>Aden-Q/leetcode<filename>code/1641.Count-Sorted-Vowel-Strings.py<gh_stars>1-10
class Solution:
def countVowelStrings(self, n: int) -> int:
d = ['a', 'e', 'i', 'o', 'u']
path = []
count = 0
def backtracking(n, start):
nonlocal count
if n == 0... | StarcoderdataPython |
1798846 | <filename>src/wrappers/python/pygroupsig/signature_build.py
# file "signature_build.py"
from pygroupsig.common_build import ffibuilder
ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *sig;
} groupsig_signature_t;
""")
ffibuilder.cdef("""
typedef groupsig_signature_t* (*groupsig_signature_init_f)(void);
"""... | StarcoderdataPython |
1779382 | import argparse
from wikidata import MOON
def parse_arguments(arguments: list[str]) -> argparse.Namespace:
"""Parse command-line arguments."""
parser: argparse.ArgumentParser = argparse.ArgumentParser()
parser.add_argument(
"-b",
"--body",
metavar="<integer>",
help=f"astr... | StarcoderdataPython |
1767094 | from __future__ import division
%pylab inline
import os
import numpy as np
import PIL.Image as pil
import tensorflow as tf
from SfMLearner import SfMLearner
from utils import normalize_depth_for_display
import cv2
import glob
import gc
def saveGraph(path, ckpt_file, img_height, img_width):
tf.reset_default_graph... | StarcoderdataPython |
3207598 | from talon import ctrl, ui, Module, Context, actions, clip, app
ctx = Context()
mod = Module()
apps = mod.apps
apps.linear = """
app.name: Linear
"""
ctx.matches = r"""
app: linear
"""
| StarcoderdataPython |
3220279 | import ast
import os
import sys
from logging import getLogger
from thonny.plugins.cpython_backend import MainCPythonBackend, get_backend
logger = getLogger(__name__)
def augment_ast(root):
mode = os.environ.get("PGZERO_MODE", "False")
assert mode != "False"
warning_prelude = "WARNING: Pygame Zero mode ... | StarcoderdataPython |
1657239 | <reponame>wjtxlliubin/simpysql<filename>simpysql/Util/Logger.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Log日志类"""
__author__ = ''
import logging
import datetime
class Logger(object):
_instance = None
_logger = None
def __new__(cls, *args, **kw):
if not cls._instance:
cls... | StarcoderdataPython |
3349396 | import os
import pytest
@pytest.fixture
def settings_class():
from fractal.core.utils.settings import Settings
class FakeSettings(Settings):
APP_NAME = os.getenv("APP_NAME", "app_name")
def load(self):
self.WEBSITE_HOST = os.getenv("WEBSITE_HOST", "http://localhost:8000")
r... | StarcoderdataPython |
3270559 | <reponame>inna-btc/secrets-manager
from keeper_secrets_manager_core.core import SecretsManager
| StarcoderdataPython |
1749777 | <filename>src/Python/Widgets/SphereWidget.py
import vtk
# Call back function
def sphereCallback(obj, event):
print('Center: {}, {}, {}'.format(*obj.GetCenter()))
def main():
colors = vtk.vtkNamedColors()
# colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])
# A renderer and render window
renderer =... | StarcoderdataPython |
3240876 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import selenium.webdriver.support.ui as ui
from selenium.common.exceptions import NoSuchElementException, TimeoutException, ElementNotVisibleException, WebDriverExce... | StarcoderdataPython |
1736757 | <filename>src/peachyprinter/infrastructure/configuration_manager.py<gh_stars>10-100
import os
import json
import types
import logging
import time
logger = logging.getLogger('peachy')
import re
from peachyprinter.domain.configuration_manager import ConfigurationManager
import peachyprinter.config as config
from peachyp... | StarcoderdataPython |
86978 | <filename>faas/restart.py
import os
from faas import app
from faas.utils import set_crash_loop, get_crash_loop_file_identifier
from faas.auth_wrapper import verify_token
from flask import request
@app.route('/restart')
@verify_token()
def restart():
exit_code = request.args.get('exit_code', default=0, type=int)
... | StarcoderdataPython |
23723 |
# 02_blink_twice.py
# From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com
import RPi.GPIO as GPIO
import time
def word_separation(pin):
sleep_time = 7
GPIO.output(pin, False) # True means that LED turns on
time.sleep(sleep_time)
def pulse(pin, length = "dot"):
... | StarcoderdataPython |
3305614 | <reponame>jamesgleave/DeepDockingGUI
from src.backend.auto_ssh import SSH
from src.backend.backend import Backend
| StarcoderdataPython |
1766263 | # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# justice-platform-service (4.10.0)
# pylint: disabl... | StarcoderdataPython |
1616611 | from dataclasses import dataclass, field
from datetime import date as date_, datetime
from typing import ClassVar, List, NamedTuple, Optional, Union
from eventkit import Event
from loguru import logger
from base.contract import Contract, TagValue
from source.base.util import EPOCH, UNSET_DOUBLE, UNSET_INTEGER
logger.a... | StarcoderdataPython |
3341128 | <reponame>AlexaHernandez/reliable-data-transfer
#!/usr/bin/python2
# file: utilities.py
def findIndex(lst, key):
for i in range(len(lst)):
if lst[i] == key:
return i
return -1
| StarcoderdataPython |
1673093 | # =====================================================
# The variable names are
# =====================================================
# ug_glob, up_glob are radial gas or particle velocity
# vg_glob, vp_glob are azimuthal gas or particle velocity
# rosg_glob, rosp_glob are gas or partic... | StarcoderdataPython |
1678448 | from collections import deque
from scipy.ndimage.measurements import label
import cv2
import numpy as np
from detect import find_cars, apply_threshold, draw_labeled_bboxes
from lane_detection import LaneDetector
class VideoProcessor():
def __init__(self):
self.frame_number = 0
self.heatmaps = deq... | StarcoderdataPython |
3240913 | <filename>experiment_ascending_auction_recipetree_random.py
#!python3
"""
A utility for performing simulation experiments on auction mechanisms.
The experiment is similar to the one described by <NAME> (2020).
In each experiment, we measure the actual vs. the optimal gain-from-trade.
This experiment using the real pr... | StarcoderdataPython |
1665444 | <gh_stars>0
lista = list()
lista_maior = list()
maior = menor = 0
for c in range(0, 5):
lista.append(int(input(f'Digite o {c + 1}ª valor: ')))
if c == 0:
maior = menor = lista[0]
lista_maior = c
else:
if lista[c] > maior:
maior = lista[c]
if lista[c] < menor:
... | StarcoderdataPython |
32124 | from pyrem.task import Task, TaskStatus
class DummyTask(Task):
def _start(self):
pass
def _wait(self):
pass
def _stop(self):
pass
class TestDummyTask(object):
@classmethod
def setup_class(klass):
"""This method is run once for each class before any tests are run"... | StarcoderdataPython |
3257376 | <filename>model/image.py
from .event import *
from database import db
import os
from PIL import Image as PILImage
class Image(Model):
__tablename__ = 'images'
event = ForeignKeyField(Event, backref='images', on_delete = 'cascade')
time = DateTimeField()
file = CharField()
def get_thumbnail_filename(self):
... | StarcoderdataPython |
3384769 | <reponame>TCGeneric/STIC
from django.contrib import admin
from .models import HistoryNode
from .models import ReferringFlow
from .models import Category
# Register your models here.
admin.site.register(HistoryNode)
admin.site.register(ReferringFlow)
admin.site.register(Category) | StarcoderdataPython |
52493 | <reponame>tjlaboss/tasty_treat<gh_stars>1-10
# Corrections
#
# Correction factors for the transport and scattering cross sections by group
from . import fuel, crd_follower, crd_poison
CORRECTIONS = {
# The 3 foundational CMM corrections
"Fuel" : fuel.CMMS,
"Crd Follower" : crd_follower.CMMS,
"Crd ... | StarcoderdataPython |
3333851 | import os # Save file location
import tempfile # Save file location
from compas.geometry import Frame
from integral_timber_joints.geometry.beam import Beam
from integral_timber_joints.geometry.joint_90lap import Joint_90lap
from integral_timber_joints.assembly import Assembly
def test_beam_joint_boolean():
leng... | StarcoderdataPython |
1663857 | from django.conf.urls import url
from app.views.api.users import views
urlpatterns = [
url(r'^$', views.api_index, name='api_users_index'),
url(r'^(?P<id_number>[0-9]+)$', views.api, name='api_users_id'),
]
| StarcoderdataPython |
68621 | <gh_stars>1-10
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from horizon.utils import filters
LOG = logging.getLogger(__name__)
class ConsumptionLink(tables.LinkAction):
name = "sumption_detail"
verbose_name = ... | StarcoderdataPython |
1669769 | <filename>down.py<gh_stars>1-10
from lxml import html
import urllib2
def get_page(url):
page = urllib2.urlopen(url)
tree = html.fromstring(page.read())
music_xpath = '/html/body/div[2]/div/a[1]'
file_a = tree.xpath(music_xpath)
return [file_a[0].text, file_a[0].attrib['href']]
url = 'http://musicforprogramming.n... | StarcoderdataPython |
199749 | import zipfile
from argostranslate.tags import translate_tags
from argostranslate.translate import ITranslation
from bs4 import BeautifulSoup
from argostranslatefiles.formats.abstract_xml import AbstractXml
class Odt(AbstractXml):
supported_file_extensions = ['.odt']
def translate(self, underlying_translat... | StarcoderdataPython |
1773428 | <filename>python_module/sirius/nlcg/cghist.py
import numpy as np
class CGHistNeugebaur:
"""
Store CG variables for every iteration
"""
types = [('iter', 'i4'),
('kappa', 'f8'),
('resX', 'f8'),
('resF', 'f8'),
('F', 'f8'),
('gamma', 'f8'... | StarcoderdataPython |
1773471 | <gh_stars>1000+
## -*- coding: utf-8 -*- ##
## Sage Doctest File ##
#**************************************#
#* Generated from PreTeXt source *#
#* on 2017-08-24T11:43:34-07:00 *#
#* *#
#* http://mathbook.pugetsound.edu *#
#* ... | StarcoderdataPython |
3296662 | <gh_stars>0
__version__ = r"1.0.0"
from typing import Any, Callable, Dict, Iterable, Type
def register_class( class_ : Type, registration_target : Dict[ Any, Type ], *acceptable_parent_classes : Iterable[ Type ], **kwargs : Dict[ str, Any ] ) -> bool:
"""
Registers into the given registration target if ... | StarcoderdataPython |
97635 | import random
from PIL import ImageFilter
from torchvision import transforms
IMAGE_SHAPE = {
'cifar10': 32,
'cifar100': 32,
'tinyimagenet': 64,
'imagenet': 256,
'lsun': 256,
'celeba': 256,
'mscoco': 256,
}
CROP_SHAPE = {
'cifar10': 32,
'cifar100': 32,
'tinyimagenet': 64,
'i... | StarcoderdataPython |
1767452 | <reponame>chriskmamo/greenvoice
from django.views.generic import TemplateView
from django.shortcuts import render
class CartView(TemplateView):
template_name = 'shop/cart.html'
def get(self, request):
context = {}
return render(request, self.template_name, context)
| StarcoderdataPython |
3371526 | <reponame>julianirwin/hloopy
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import numpy as np
from numpy import rot90
from os.path import split
from collections import defaultdict
class GridPlotBase:
def extract(self, *args):
self.extracts += args
def _parse_legend_param(... | StarcoderdataPython |
3370547 | <reponame>Saluev/cocos2d-gui
# built-in
import weakref
# PyOpenGL
from OpenGL import GL, GLU
# pyglet
import pyglet
# cocos2d
import cocos
from cocos.director import director
from .utility import reverse
class SmartNode(cocos.cocosnode.CocosNode, pyglet.event.EventDispatcher):
nodes_by_id = weakref.WeakValueDiction... | StarcoderdataPython |
1762660 | # problem 24
# Lexicographic permutations
"""
A permutation is an ordered arrangement of objects.
For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4.
If all of the permutations are listed numerically or alphabetically, we call it lexicographic order.
The lexicographic permutations of 0, 1 and ... | StarcoderdataPython |
68799 | from __future__ import unicode_literals
import collections
import restea.errors as errors
import restea.formats as formats
import restea.fields as fields
# TODO: Add fileds with validation
class Resource(object):
'''
Resource class implements all the logic of mapping HTTP methods to
methods and error ha... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.