id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3257844 | <filename>blog_app/migrations/0008_seodata.py
# Generated by Django 4.0.2 on 2022-05-01 11:29
import django.core.validators
from django.db import migrations, models
import users.validators
class Migration(migrations.Migration):
dependencies = [
('blog_app', '0007_alter_post_image'),
]
operation... | StarcoderdataPython |
138373 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017, OpenCensus 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
#
# Unle... | StarcoderdataPython |
4801362 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-09 12:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0004_auto_20160709_0117'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
154526 | """Aireplay-ng"""
import asyncio
from parse import parse
from .executor import ExecutorHelper
class AireplayNg(ExecutorHelper):
""" Aireplay-ng 1.6 - (C) 2006-2020 <NAME>
https://www.aircrack-ng.org
Usage: aireplay-ng <options> <replay interface>
Options:
-b bssid : MAC address, Access ... | StarcoderdataPython |
1712321 | <filename>ybdata/__init__.py
# ybdata
# Yellowbrick datasets management and deployment scripts.
#
# Author: <NAME> <<EMAIL>>
# Created: Sun Dec 30 08:50:55 2018 -0500
#
# For license information, see LICENSE.txt
#
# ID: __init__.py [] <EMAIL> $
"""
Yellowbrick datasets management and deployment scripts.
"""
######... | StarcoderdataPython |
1602395 | <gh_stars>1-10
"""
"""
from __future__ import annotations
import contextlib
import threading
from contextlib import contextmanager
from typing import Any
from typing import Iterator
from typing import MutableMapping
from .utils.collection import Config
from .utils.collection import DotDict
from .utils.collection imp... | StarcoderdataPython |
1693066 | import bs64, os, jcr
from cryptography.fernet import Fernet
print("+--->\n| CrypterPy 1.0\n+--->")
os.makedirs("./cache", mode=0o777, exist_ok=True)
if input("e?>>> ") == "y":
name_r = input("Result name>>> ")
dirs = input("Folder >>>")
jcr.tojson(name_r+".ncf", dirs)
key = Fernet.generate_key()
open("./"+name_r+... | StarcoderdataPython |
133509 | __version__= "v0.10" | StarcoderdataPython |
3279436 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 08:44:06 2017
@author: davidpvilaca
"""
import cv2
def detectFaceAndEyes(img):
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
gray = cv2.cvtColo... | StarcoderdataPython |
3385696 | <reponame>datawire/quark<gh_stars>100-1000
# Copyright 2015 datawire. 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
#... | StarcoderdataPython |
3344138 | #!/usr/bin/env python
from imu import IMU
import sys
myImu = IMU()
chr = sys.stdin.read(1)
| StarcoderdataPython |
4824700 | from django.core.management.base import BaseCommand
from django.db import transaction
from django_scopes import scope
from pretalx.event.models import Event
from pretalx_downstream.tasks import task_refresh_upstream_schedule
class Command(BaseCommand):
help = "Pull an event's upstream data"
def add_argument... | StarcoderdataPython |
3393761 | <gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('api/RiboVision/v1.0/fetchMasterList', views.fetchmasterlist),
path('api/RiboVision/v1.0/fetchResidues', views.fetchresidues),
path('api/RiboVision/v1.0/speciesTable', views.speciesta... | StarcoderdataPython |
1693777 |
# Generated by Django 2.0.9 on 2018-12-19 13:21
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.db import migrations
from opentech.apply.users.groups import APPLICANT_GROUP_NAME
def set_group(apps, schema_editor):
U... | StarcoderdataPython |
1611218 | from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.preprocessing import image
from tensorflow.keras.optimizers import RMSprop
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import cv2
import os
def covidTest(filePath):
train = ImageDataGenerator(r... | StarcoderdataPython |
1673621 | <gh_stars>1-10
'''
Test cases for class AnnotateCommand
The construction of the test case are driven by the fact that the target cigar
only has three types of regions: M(M_0), D(D_0), and I(I_0). For a region mapped
to a target genome, its start and end position will always be in M_0 or I_0,
because only M_0 and I_0... | StarcoderdataPython |
4834495 | #any import functions, other functinos can be written here and then imported.
import os
from zipfile import ZipFile
def handle_uploaded_file(f):
with open('/projects/team-2/abharadwaj61/django/predictivewebserver/genome_assembly/static/upload/'+f.name, 'wb+') as destination:
for chunk in f.ch... | StarcoderdataPython |
1728334 | <gh_stars>1-10
import re
import sys
import spacy
import unicodedata
import numpy as np
import pandas as pd
import ipywidgets as widgets
from ipywidgets import interact
from ipywidgets import GridspecLayout
from termcolor import colored
from IPython.display import display
from spacy.lang.en.stop_words import STOP_WORDS... | StarcoderdataPython |
3328233 | import logging
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, permissions, viewsets
from waldur_core.core import mixins as core_mixins
from waldur_core.structure import filters as structure_filters
from waldur_core.structure import permissions as structure_permissio... | StarcoderdataPython |
3323870 | #from http://stackoverflow.com/questions/12524994/encrypt-decrypt-using-pycrypto-aes-256
import base64
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[:-ord(s[len(s)-1:])]
class AESCipher:
def __init__( self, key ... | StarcoderdataPython |
3372475 | <gh_stars>100-1000
import numpy as np
import zengl
from utils import glsl
def test_render_triangle(ctx: zengl.Context):
img = ctx.image((256, 256), 'rgba8unorm')
triangle = ctx.pipeline(
vertex_shader=glsl('triangle.vert'),
fragment_shader=glsl('triangle.frag'),
framebuffer=[img],
... | StarcoderdataPython |
4811604 | <gh_stars>0
#!/usr/bin/env python3
from netmiko import ConnectHandler
from getpass import getpass
ciscoswitch1 = {
"device_type": "cisco_nxos",
"host": "nxos1.lasthop.io",
"username": "pyclass",
# "password": getpass(),
"password": "<PASSWORD>",
"session_log": "session.txt",
... | StarcoderdataPython |
135716 | <reponame>gitguige/openpilot0.8.9
#!/usr/bin/env python3
import argparse
import carla # pylint: disable=import-error
import math
import numpy as np
import time
import threading
from cereal import log
from multiprocessing import Process, Queue
from typing import Any
import cereal.messaging as messaging
from common.para... | StarcoderdataPython |
1710300 | <filename>tests/test_dependencies.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
"""Tests for `dparse.dependencies`"""
import pytest
from dparse.dependencies import Dependency, DependencyFile
from dparse import filetypes, parse, parser, errors
def test_depe... | StarcoderdataPython |
3352821 | import os
from textwrap import dedent
def aws_creds_setup(config):
if config.getboolean('AWS', 'setupAwsKeys') is True:
access_key = config.get('AWS', 'awsAccessKeyId', fallback='')
secret_key = config.get('AWS', 'awsSecretAccessKey', fallback='')
region = config.get('AWS', 'region', fallba... | StarcoderdataPython |
1799887 | <reponame>lengstrom/fastargs
STATE = {
'config': None
}
def get_current_config():
if STATE['config'] is None:
from .config import Config
STATE['config'] = Config()
return STATE['config']
def set_current_config(config):
STATE['config'] = config
| StarcoderdataPython |
95560 | # Generated by Django 3.1.13 on 2022-04-24 15:45
import app.storage
from django.conf import settings
from django.db import migrations, models, transaction
import django.db.models.deletion
import uuid
import versatileimagefield.fields
def create_slack_users(apps, schema_editor):
SlackUser = apps.get_model("messag... | StarcoderdataPython |
1726216 | <reponame>gerritholl/sattools<gh_stars>0
"""Test visualisation routines."""
import datetime
from unittest.mock import patch, MagicMock
import pytest
import pyresample
from . import utils
def test_show(fakescene, fakearea, tmp_path):
"""Test showing a scene and area."""
import sattools.vis
from satpy i... | StarcoderdataPython |
73783 | <reponame>testtech-solutions/ProcessPlot
"""
Copyright (c) 2021 <NAME> <EMAIL>, <NAME> <EMAIL>
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... | StarcoderdataPython |
1618657 | '''
@author <NAME>
Please contact <EMAIL>
'''
import torch
import torch.nn.functional as F
from torch.autograd import Variable
'''
<NAME>., <NAME>., & <NAME>. (2014).
Neural machine translation by jointly learning to align and translate.
arXiv preprint arXiv:1409.0473.
<NAME>., <NAME>., & <NAME>. (2015).
Effective a... | StarcoderdataPython |
1707385 | <reponame>arvind-iyer/impersonator<gh_stars>0
import cv2
import numpy as np
from matplotlib import pyplot as plt
HMR_IMG_SIZE = 224
IMG_SIZE = 256
def read_cv2_img(path):
"""
Read color images
:param path: Path to image
:return: Only returns color images
"""
if type(path) is str:
img ... | StarcoderdataPython |
3200695 | """
Installs dependencies in current conda environment.
Args:
--gpu: Force installing a gpu version. When not specified, the script only installs a gpu version when cuda is detected.
"""
import sys
import subprocess
import argparse
from cuda_check import get_cuda_version
def is_torch_installed() -> bool:
tr... | StarcoderdataPython |
3361769 | class Solution:
def XXX(self, height: List[int]) -> int:
maxl = 0
maxr = len(height) - 1
left = maxl
right = maxr
maxq = (right - left) * min(height[left],height[right])
while left < right :
if height[maxl] < height[maxr]:
while height[max... | StarcoderdataPython |
4839166 | <gh_stars>0
# coding=utf-8
# Exemplos para entendiemnto
"""nome = input('Qual seu nome?' )
if nome == 'Rodrigo' or nome == 'RAYANNE':
print('Que nome lindo vocé tem!')
else:
print('Que nome tão normal!!!')
print('Bom dia, {}'.format(nome))"""
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digit... | StarcoderdataPython |
3340285 | # Build external deps.
{
'variables': { 'target_arch%': 'x64' },
'target_defaults': {
'default_configuration': 'Debug',
'configuration': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'msvs_settings': {
'VSSLCompilerTool': {
... | StarcoderdataPython |
3255922 | import os
from clint.textui import puts, indent, columns, colored
from pytube import YouTube, exceptions
def draw_progress_bar(stream=None, chunk=None, file_handle=None, remaining=None):
file_size = stream.filesize
percent = (100 * (file_size - remaining)) / file_size
puts('\r', '')
with indent(4):
... | StarcoderdataPython |
1776150 | <gh_stars>0
import time
from bs4 import BeautifulSoup
import lib.longtask as longtask
from datastore.models import Indexer, WebResource
from google.appengine.api import memcache
__author__ = 'Lorenzo'
def store_feed(e):
"""
store a single entry from the feedparser
:param e: the entry
:return: if succ... | StarcoderdataPython |
3221957 | <reponame>emsalinha/videosum-eval<filename>score_evaluators/rank_corr_evaluator.py<gh_stars>0
# %% md
# Compute rank order statistics on annotated frame importance scores
import sys
import numpy as np
from scipy.stats import kendalltau, spearmanr
from scipy.stats import rankdata
sys.path.append('/home/emma/summary_ev... | StarcoderdataPython |
1754877 | import logging
from typing import Any, Dict, Text
from rasa.shared.nlu.constants import INTENT, ENTITIES, TEXT
from rasa.shared.nlu.training_data.formats.readerwriter import JsonTrainingDataReader
from rasa.shared.nlu.training_data.training_data import TrainingData
from rasa.shared.nlu.training_data.message import Me... | StarcoderdataPython |
1641498 | <gh_stars>1-10
"""empty message
Revision ID: d2d91cf1ca9
Revises: None
Create Date: 2015-10-20 21:24:42.398717
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adju... | StarcoderdataPython |
1717535 | <gh_stars>10-100
"""
mainly pulser tagging
- gaussian_cut (fits data to a gaussian, returns mean +/- cut_sigma values)
- xtalball_cut (fits data to a crystalball, returns mean +/- cut_sigma values)
- find_pulser_properties (find pulser by looking for which peak has a constant time between events)
- tag_pulsers
"""
impo... | StarcoderdataPython |
56523 | <filename>cookies_website/apps.py
from django.apps import AppConfig
class CookiesWebsiteConfig(AppConfig):
name = 'cookies_website'
| StarcoderdataPython |
1790956 | <reponame>pyansys/pyaedt
import sys
import threading
import warnings
from pyaedt.generic.general_methods import is_ironpython
if not is_ironpython:
try:
import numpy as np
except ImportError:
warnings.warn(
"The NumPy module is required to run some functionalities of PostProcess.\n... | StarcoderdataPython |
181810 | import os
import os.path as op
import sys
import re
import logging
import shutil as sh
import tqdm
import time
from tqdm import trange
from time import sleep
def main():
pbar1 = tqdm.tqdm(
total=100,
position=0,
colour="green",
desc="First",
ncols=80,
mininterval=... | StarcoderdataPython |
43665 | <reponame>surily/Udacity-Data-Science
from setuptools import setup
setup(name='gaussian_bionary_dist_prob',
version='0.1',
description='Gaussian and Binomial distributions',
packages=['gaussian_bionary_dist_prob'],
author = '<NAME>',
author_email = '<EMAIL>',
zip_safe=False)
| StarcoderdataPython |
3381555 | <gh_stars>10-100
# -*- coding: utf-8 -*-
'''
Copy this as a secrets.py
'''
token = '-----------------------------------------------------------------------'
client_secret = '--------------------'
app_id = 1111111
| StarcoderdataPython |
3297271 | class Solution:
def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
N = len(A)
# create hash table to record C+D combinations:
cd = {}
for i in range(N):
for j in range(N):
if C[i] + D[j] not in cd:
cd... | StarcoderdataPython |
3370316 | stack_server_config: dict = {
"host": "172.17.0.1",
"disableHostCheck": True,
"publicPath": "/",
"public": "https://dev.flexio.io/devui",
"sockPath": "/socketjs",
"proxy": [
{
"context": [
"//[a-z]+/*"
],
"logLevel": "debug",
... | StarcoderdataPython |
1753938 | <gh_stars>10-100
def method1_iterative(n: int, l: list) -> int:
low = 0
high = len(l) - 1
mid = 0
while low <= high:
mid = (low + high) // 2
if l[mid] < n:
low = mid + 1
elif l[mid] > n:
high = mid - 1
else:
return mid
return -1
i... | StarcoderdataPython |
3301829 | <reponame>jacaboyjr/pythonbirds
"""
Programa destinado a ler o dia data e ano de nascimento do usuário
"""
dia = int(input('Qual foi o dia do seu nascimento? '))
mes = str(input('Qual foi o mes do seu nascimento? '))
ano = int(input('Qual foi o ano do seu nascimento? '))
print(f'Você nasceu no DIA {dia} de {mes} de {... | StarcoderdataPython |
3248861 | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import auc, roc_curve
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import LabelEncoder
from sklearn.svm import LinearSVC
def mean_on_fold(train, test, y):
return np.one... | StarcoderdataPython |
100743 | """"""
from collections import OrderedDict
import logging
import mmap
from struct import unpack
from pydcmjpeg._markers import MARKERS
from pydcmjpeg.jpeg import get_jpeg
LOGGER = logging.getLogger('pdcmjpeg')
def jpgmap(fpath):
"""Return a memory-mapped representation of the JPEG file at `fpath`."""
LOGG... | StarcoderdataPython |
35756 | <reponame>raistlin7447/AoC2021<gh_stars>0
with open("day6_input.txt") as f:
initial_fish = list(map(int, f.readline().strip().split(",")))
fish = [0] * 9
for initial_f in initial_fish:
fish[initial_f] += 1
for day in range(80):
new_fish = [0] * 9
for state in range(9):
... | StarcoderdataPython |
1704107 | """
This example code illustrates how to access and reproject a TerraFusion
Advanced Fusion file in Python.
Usage: save this script and run
$python modis2ug.rn.py
The HDF file must be in your current working directory.
Tested under: Python 3.6.6 :: Anaconda custom (64-bit)
Last updated: 2019-04-05
"""
import h... | StarcoderdataPython |
1632031 | <gh_stars>1-10
""" Test example of LAR of a 2-complex with non-contractible and non-manifold cells"""
from larlib import *
V = [[0.0989,0.492],[0.5,0.492],[0.708,0.6068],[0.2966,0.6068],[1.0,0.0],
[0.0,0.0],[1.0,1.0],[0.0,1.0],[0.5,0.2614],[0.0989,0.2614],[0.8034,
0.1273],[0.8034,0.0386],[0.0989,0.9068],[0.892,0.9068... | StarcoderdataPython |
1739556 | <gh_stars>0
import collections
import enum
import time
import numpy as np
from collections import namedtuple, deque
# one single experience step
from common.environments import Status
from common.fast_rl.common.statistics import StatisticsForValueBasedRL, StatisticsForPolicyBasedRL
from common.fast_rl.rl_agent import... | StarcoderdataPython |
128468 | # Generated by Django 2.2.5 on 2019-10-16 18:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('wi... | StarcoderdataPython |
1715496 | from django.contrib import admin
from django.urls import include, path
from . import views
# For production, do not store static files in Django.
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.conf import settings
from articles import views as ... | StarcoderdataPython |
3362988 | <filename>REIP/image_processing/restore_blur.py
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob
from IPython.display import clear_output
from numpy import expand_dims
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from ker... | StarcoderdataPython |
3399858 | <reponame>Tontolda/genui
from django.contrib import admin
import genui.generators.extensions.genuidrugex.models
from . import models
@admin.register(models.Generator)
class GeneratorAdmin(admin.ModelAdmin):
pass
@admin.register(genui.generators.extensions.genuidrugex.models.DrugExNet)
class DrugExNetAdmin(admin.... | StarcoderdataPython |
133426 | <reponame>erathorus/rainbow
import argparse
from rainbow import Rainbow
def main():
# Setup flags
parser = argparse.ArgumentParser(description='Bridge Contentful and Hugo')
parser.add_argument('store-id')
parser.add_argument('access-token')
parser.add_argument('content-directory')
args = vars(... | StarcoderdataPython |
3322840 | import sys
with open(sys.argv[1]) as f:
lines = f.readlines()
f1s = []
passed_ceafm = False
for line in lines:
if "Coreference" in line:
if len(f1s) == 2 and not passed_ceafm:
passed_ceafm = True
continue
f1s.append(float(line.split()[-1].... | StarcoderdataPython |
3287200 | <reponame>forbug/mcs-cycic-analysis<gh_stars>0
from dataclasses import dataclass
from mcs_cycic_analysis.models.cycic3_label import Cycic3Label
from mcs_cycic_analysis.models.cycic3_question import Cycic3Question
@dataclass
class Cycic3EntangledQuestionPair:
part_a_question: Cycic3Question
part_a_label: Cyci... | StarcoderdataPython |
46416 | <reponame>drewsynan/ariadne_django<filename>ariadne_django/__init__.py
import django
if django.VERSION < (3, 2):
default_app_config = "ariadne_django.apps.AriadneDjangoConfig"
| StarcoderdataPython |
4837818 | <gh_stars>0
#T.BRADFORD
#July 2021
import numpy as np
import sqlalchemy
import datetime as dt
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
#################################################
# Database Se... | StarcoderdataPython |
1737156 | <filename>lib/python2.7/site-packages/praw/decorator_helpers.py
"""Internal helper functions used by praw.decorators."""
import inspect
from requests.compat import urljoin
import six
import sys
def _get_captcha(reddit_session, captcha_id):
"""Prompt user for captcha solution and return a prepared result."... | StarcoderdataPython |
70303 | #!/usr/bin/env python
"""
Example of training DCGAN on MNIST using PBT with Tune's function API.
"""
import ray
from ray import tune
from ray.tune.schedulers import PopulationBasedTraining
import argparse
import os
from filelock import FileLock
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.o... | StarcoderdataPython |
3366677 | from dotenv import load_dotenv
import fetch_calendar
import fetch_formatted_text
from inky.auto import auto
import os
import time
# loads environment variables froma .gitignore'd .env file
load_dotenv()
# RC calendar token from .env
token = os.getenv('ICS_TOKEN')
inky_display = auto()
inked_name = ''
inked_location ... | StarcoderdataPython |
168086 | <reponame>kayew/aoc-2020<gh_stars>0
#!/usr/bin/env python3
from sys import argv
from math import cos, sin
from math import radians as toR
data = [x.strip() for x in open(argv[1]).readlines()]
x = 0
y = 0
wp = [10, 1] # x, y / EW, NS
for s in data:
dir = s[0]
amnt = int(s[1:])
if dir == "N":
wp[1... | StarcoderdataPython |
3381793 | <gh_stars>1-10
# pylint: disable=C0321, C0114, W0702, C0103, C0301, R1710, W0603, W0621
"""
Adds support for Telegram Bot messaging.
To enable, provide a TELEGRAM_TOKEN environment variable.
"""
import logging
from os import getenv
from asyncio import sleep
from aiogram import Bot, Dispatcher, types
from aiogram.uti... | StarcoderdataPython |
1766347 | import warnings
from torch.optim.lr_scheduler import ReduceLROnPlateau
from .base import BaseHook
from .registry import HOOKS
@HOOKS.register_module
class LRSchedulerHook(BaseHook):
def __init__(self, monitor_metric="loss", by_epoch=True):
self.monitor_metric = monitor_metric
self.by_epoch = by_... | StarcoderdataPython |
3274916 | import docker
class DockerLite:
def __init__(self):
self.client = docker.from_env()
def build_image(self, path_to_dir, resulting_image_name):
"""A method to build a Docker image from a Dockerfile.
Args:
path_to_dockerfile: string: the path to the Dockerfile
re... | StarcoderdataPython |
36628 | <reponame>Joyoe/Magisk-nosbin_magisk-nohide
# Copyright (C) 2007-2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# policygentool is a tool for the initial generation of SELinux policy
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Gene... | StarcoderdataPython |
3229010 | import datetime
from Models.Rental import Rental
from pyforms import BaseWidget
from pyforms.Controls import ControlButton, ControlLabel
from pyforms.Controls import ControlText
# TO DO: write specifications
class RentalWindow(Rental, BaseWidget):
def __init__(self, isCreating):
Rental... | StarcoderdataPython |
1601095 | from pathlib import Path
import numpy as np
import torch.nn as nn
class FeatureExtractor(object):
def __init__(self):
super(FeatureExtractor).__init__()
def initialize(self, trainer):
self.feature_path = trainer.logger.log_path / 'features'
if not self.feature_path.exists():
... | StarcoderdataPython |
3344325 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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/licen... | StarcoderdataPython |
180299 | import sys
if __name__ == "__main__":
from common import powerset
from log_star_decider import _is_log_star_solvable
else:
from .common import powerset
from .log_star_decider import _is_log_star_solvable
from .constant_synthesizer import find_algorithm
VERBOSE = False
def is_constant_solvable(co... | StarcoderdataPython |
4839961 | <gh_stars>1-10
"""A module for the Genomic Uncertain Deletion Classifier."""
from typing import List
from .set_based_classifier import SetBasedClassifier
from variation.schemas.classification_response_schema import ClassificationType
class GenomicUncertainDeletionClassifier(SetBasedClassifier):
"""The Genomic Unc... | StarcoderdataPython |
170656 | <reponame>ingjavierpinilla/youBot-Gazebo-Publisher
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float64
import trajectory_msgs.msg as tm
from numpy import inf, zeros, ones
from geometry_msgs.msg import Twist
def moveArm():
armPublisher = rospy.Publisher(
"/arm_1/arm_controller/command", tm... | StarcoderdataPython |
1645611 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def generateCounts(self, root):
if not root:
return 0
else:
root.counts = [self.generateCounts(... | StarcoderdataPython |
3263542 | <gh_stars>1-10
from qittle.types.responses import hook
from .base import Base
class HookCategory(Base):
async def register(
self,
param: str,
hook_type: int = 1,
txn_type: str = 2,
**kwargs
) -> hook.DescriptionModel:
params = sel... | StarcoderdataPython |
67319 | from backtrader import indicators
from src.analyzer.backtrader_wrapper.base_screener import BaseScreener
from src.analyzer.backtrader_wrapper.base_strategy import BaseStrategy
from src.analyzer.backtrader_wrapper.interface_algo import AlgoInterface
class SimpleMovingAverageAlgo(AlgoInterface):
params = dict(maper... | StarcoderdataPython |
3382510 | <filename>ermaket/api/queries/__init__.py
from .read import *
from .change import *
from .errors_parser import *
from .sql import *
| StarcoderdataPython |
58090 | import os
import re
import time
import shutil
from tempfile import mkdtemp
import operator
from collections.abc import Mapping
from pathlib import Path
import datetime
from .log import Handle
logger = Handle(__name__)
_FLAG_FIRST = object()
class Timewith:
def __init__(self, name=""):
"""Timewith contex... | StarcoderdataPython |
38031 | <gh_stars>0
"""
Date: 2022.04.13 10:28
Description: Omit
LastEditors: <NAME>
LastEditTime: 2022.04.13 10:28
"""
import tempfile
from pathlib import Path
from create_config_file.notes import notes_append_header
def test_notes_append_header():
path = tempfile.gettempdir()
file = Path(path) / "file.txt"
fi... | StarcoderdataPython |
1704720 | <reponame>zerontech-company/pytorch-code-server
from dagster import get_dagster_logger, job, op, In
from my_mnist import *
@op
def setHyper():
epoch = 20
hyper = { "batch_size": 50, "num_classes": 10, "learning_rate": 0.001, "num_epochs": epoch }
return hyper
@op(ins={'msg': In(int)})
def print_test(ms... | StarcoderdataPython |
3266906 | <reponame>giumas/testwheel
from __future__ import (absolute_import, division, print_function)
import pytest
import testwheel
class TestBase(object):
def test_zero(self):
""" Testing author name string. """
assert "giumas" == testwheel.__author__
| StarcoderdataPython |
1671180 | <filename>ana/debug/polarization.py<gh_stars>10-100
#!/usr/bin/env python
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | StarcoderdataPython |
118008 | # 面向过程的程序设计,把计算机程序视为一系列的命令集合,即一组函数的顺序执行。为了简化程序设计,面向过程把函数继续切分为子函数,
# 即把大块函数通过切割成小块函数来降低系统的复杂度。
# 面向对象编程,OOP,Object Oriented Programming,一种程序设计思想。OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数。
# 面向对象的程序设计把计算机程序视为一组对象的集合,而每个对象都可以接收其他对象发过来的消息,并处理这些消息,
# 计算机程序的执行就是一系列消息在各个对象之间传递。
# 所以,面向对象的设计思想是抽象出Class,根据Class创建Instance,面向对象的抽象程度又比函... | StarcoderdataPython |
30366 | <filename>spraycharles/utils/notify.py<gh_stars>0
import pymsteams
from discord_webhook import DiscordWebhook
from notifiers import get_notifier
def slack(webhook, host):
slack = get_notifier("slack")
slack.notify(message=f"Credentials guessed for host: {host}", webhook_url=webhook)
def teams(webhook, host)... | StarcoderdataPython |
3307244 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Kernel-IO
GUID : abf1f586-2e50-4ba8-928d-49044e6f0db7
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from e... | StarcoderdataPython |
3346155 | import os
import uuid
from flask import Flask,render_template,request, make_response
from utils.run_model import getBaseMap
app=Flask(__name__)
@app.route("/")
def index():
return render_template("upload.html")
@app.route("/validate")
def validate():
return render_template("validate.html")
... | StarcoderdataPython |
1780036 | import pygame
import time
from pygame.constants import MOUSEBUTTONDOWN
# board = [ [ 3, 1, 6, 5, 7, 8, 4, 9, 2 ],
# [ 5, 2, 9, 1, 3, 4, 7, 6, 8 ],
# [ 4, 8, 7, 6, 2, 9, 5, 3, 1 ],
# [ 2, 6, 3, 0, 1, 5, 9, 8, 7 ],
# [ 9, 7, 4, 8, 6, 0, 1, 2, 5 ],
# [ 8, 5, 1, 7, 9, 2, 6, 4... | StarcoderdataPython |
134918 | <gh_stars>0
for i in range(int(input())):
H, W ,N = map(int,input().split())
temp = N
tmp = 1
#층
if N%H == 0:
temp = H
else:
temp = N%H
#호수
if N/H > int(N/H):
tmp = int(N/H)+1
else:
tmp = int(N/H)
if tmp < 10:
print(temp,"0",tmp,sep... | StarcoderdataPython |
127762 | #!/usr/bin/env python
# encoding=utf-8
import ConfigParser
import sys, os
sys.path.append("..")
PROC_DIR = os.path.abspath('..')
class LoadConfig:
cf = ''
filepath = PROC_DIR + "/conf/default.ini"
def __init__(self):
try:
f = open(self.filepath, 'r')
except IOError, e:
... | StarcoderdataPython |
4838012 | import os
import pytest
from db_transfer.transfer import Transfer, sent_env
def yaml_transfer():
os.environ['yaml_file_path'] = './test_yaml.yaml'
@sent_env('yaml', 'FILE_LOCAL', 'yaml_file_path')
class TestHandlerYaml(Transfer):
pass
yaml_transfer = TestHandlerYaml(namespace='namespace_1',... | StarcoderdataPython |
4837573 | <gh_stars>0
import argparse
import logging
import os
import sys
from collections import OrderedDict
from os.path import join, splitext
from autoanalysis.processmodules.imagecrop.TIFFImageCropper import TIFFImageCropper
from autoanalysis.processmodules.imagecrop.BioformatsImageReader import BioformatsImageReader
class... | StarcoderdataPython |
1704435 | s = None
def Oracle_Connect():
import socket
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(('172.16.31.10', 80))
except socket.error as e:
print e
return -1
print "Connected to server successfully."
return 0
def Oracle_Disconnect():... | StarcoderdataPython |
1683542 | <reponame>psbsgic/rabbitai
import logging
from typing import Optional
from flask import flash, request, Response
from flask_appbuilder import expose
from flask_appbuilder.security.decorators import has_access_api
from werkzeug.utils import redirect
from rabbitai import db, event_logger
from rabbitai.models import cor... | StarcoderdataPython |
3236001 | from django_tgbot.decorators import processor
from django_tgbot.state_manager import message_types, update_types, state_types
from django_tgbot.types.update import Update
from ..bot import state_manager, TelegramBot
from ..models import TelegramState
from ..BotSetting import BotName, ChannelName
from .BotDialog import... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.