id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1747390 | <filename>syft/generic/pointers/object_pointer.py
from typing import List
from typing import Union
from typing import TYPE_CHECKING
import syft
from syft import exceptions
from syft.messaging.message import ForceObjectDeleteMessage
from syft.generic.frameworks.hook import hook_args
from syft.generic.object import Abst... | StarcoderdataPython |
27843 | <filename>chatting/models.py
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Chat(models.Model):
content = models.TextField()
sender = models.ForeignKey(User)
receiver = models.ForeignKey(User)
date_creat... | StarcoderdataPython |
1752621 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
import services
import sims4.commands
from typing import It... | StarcoderdataPython |
3299279 | from builtins import object
from django.db.models import Q, Count
from django.db.models.aggregates import Sum
from django.contrib.contenttypes.models import ContentType
from memoize import memoize
from moneyed.classes import Money
from bluebottle.clients import properties
from bluebottle.initiatives.models import ... | StarcoderdataPython |
1785134 | from hookscript import request
resource = request.values['resource']
if resource == 'cpu':
while True:
pass
elif resource == 'mem':
x = 'xxxxxxxxxxxxxxxxxx'
while True:
x += x
elif resource == 'disk':
f = open('junk','w')
while True:
print('junk', file=f)
elif resource == 'o... | StarcoderdataPython |
3243702 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-08 18:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("api", "0029_auto_20170507_1251")]
operations = [
migrations.AddField(
... | StarcoderdataPython |
4824413 | try:
from waterbutler import settings
except ImportError:
settings = {}
config = settings.get('GOOGLEDRIVE_PROVIDER_CONFIG', {})
BASE_URL = config.get('BASE_URL', 'https://www.googleapis.com/drive/v2')
BASE_UPLOAD_URL = config.get('BASE_UPLOAD_URL', 'https://www.googleapis.com/upload/drive/v2')
DRIVE_IGNORE_... | StarcoderdataPython |
1621474 | from __future__ import absolute_import, unicode_literals
from mopidy.internal import validation
from mopidy.models import Ref, TlTrack, fields
from mopidy.models.immutable import ValidatedImmutableObject
class HistoryTrack(ValidatedImmutableObject):
"""
A history track. Wraps a :class:`Ref` and its timestamp... | StarcoderdataPython |
106392 | <filename>tests/web.adblockplus.org/pages/landingPage.py
from pages.basePage import BasePage
DOWNLOAD_BUTTON_HREF = 'a[href*="install"]'
DOWNLOAD_BUTTON_HREF_ANDROID = 'a[href*="https://eyeo.to/adblockbrowser/android/abp-website"]'
DOWNLOAD_BUTTON_HREF_IOS = 'a[href*="https://eyeo.to/adblockplus/ios_safari_install/abp... | StarcoderdataPython |
1663034 | <filename>examples/cleanup_clips.py
#!/usr/bin/env python
# Copyright (c) 2015 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
"""
This script lists ... | StarcoderdataPython |
30333 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | StarcoderdataPython |
1660401 | # Form implementation generated from reading ui file 'frmlogin.ui'
#
# Created: Mon Nov 13 22:02:43 2000
# by: The Python User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
from qt import *
class Login(QDialog):
def __init__(self, parent = None, name = None, modal... | StarcoderdataPython |
3379002 | <reponame>cheperboy/home_alarm
from flask import Flask, Blueprint, render_template, redirect, url_for, request, flash
from ..models import DBLog
alarms_panel = Blueprint('panel', __name__, url_prefix='/')
@alarms_panel.route('/')
#@<EMAIL>('/panel_nox_bind')
def index():
"""Panel for ext bind to nox"""
retur... | StarcoderdataPython |
124887 | <filename>explorecourses/classes.py
"""
This module contains classes representing various academic elements
for use in storing and manipulating information from Explore Courses.
Includes:
- School
- Department
- Course
- Section
- Schedule
- Instructor
- LearningObjective
- Attribute
... | StarcoderdataPython |
1773309 | <reponame>acolley/protoactor-python<filename>tests/persistence/snapshot_strategies/test_time_strategy.py
import datetime
from protoactor.persistence.messages import PersistedEvent
from protoactor.persistence.snapshot_strategies.time_strategy import TimeStrategy
def test_time_strategy_should_snapshot_according_to_the... | StarcoderdataPython |
3227468 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from mordor import AppEnv
import sys
def main():
print("hello")
print(sys.argv)
if __name__ == '__main__':
main()
| StarcoderdataPython |
3357301 | from specreduce.utils.synth_data import make_2dspec_image
from astropy.nddata import CCDData
def test_make_2dspec_image():
ccdim = make_2dspec_image(
nx=3000,
ny=1000,
background=5,
trace_center=None,
trace_order=3,
trace_coeffs={'c0': 0, 'c1': 50, 'c2': 100},
... | StarcoderdataPython |
137340 | <gh_stars>10-100
from spire.mesh import ModelController
from spire.schema import SchemaDependency
from lattice.server.resources import Project as ProjectResource
from lattice.server.models import *
class ProjectController(ModelController):
resource = ProjectResource
version = (1, 0)
model = Project
m... | StarcoderdataPython |
3219127 | """
Man Run Land Analyzer.
"""
import analyzer_lib.utils.utils as u
import analyzer_lib.data_manipulation.tables as t
from pyspark.sql.types import StructType, StructField, StringType, IntegerType, LongType, DecimalType, DoubleType, FloatType
from pyspark.sql import DataFrame, Row
from pyspark.sql import functions... | StarcoderdataPython |
1733631 | #! /usr/bin/env python
"""
Set a register preset to test different configurations on YM2612 chip
"""
from __future__ import print_function
import sys
import time
import serial
import rtmidi
# Defined constants
YM_MAX_NUM_USER_PRESETS = 8
YM_MAX_NUM_DEFAULT_PRESETS = 8
# Num voices
YM_MAX_VOICES = 6
# Num operators
Y... | StarcoderdataPython |
3224636 | class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
while (m>0 and n>0):
if (nums1[m-1]>=nums2[n-1]):
nums1[m+n-1]=nums1[m-1]
m... | StarcoderdataPython |
4835830 | <reponame>billchenxi/ClaraGenomicsAnalysis
#
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosu... | StarcoderdataPython |
3278094 | <filename>funcx_sdk/funcx/sdk/client.py
from __future__ import annotations
import asyncio
import json
import logging
import os
import typing as t
import uuid
import warnings
from funcx.sdk._environments import get_web_service_url, get_web_socket_url
from funcx.sdk.asynchronous.funcx_task import FuncXTask
from funcx.s... | StarcoderdataPython |
150032 | # -*- coding: utf-8 -*-
import click
import argparse
def _display_menu():
print 'TBC'
def _run_update():
return ('TBC')
# Backup the file
# Do the replacements
# Inform user of backup + new file name
@click.command()
@click.option('--file', help='Full path to an Apache httpd.conf file.')
@cli... | StarcoderdataPython |
1718419 | import random
import numpy as np
import cv2
import matplotlib.pyplot as plt
# from matplotlib import pyplot as plt
import scipy
from scipy import signal
from PIL import Image
from scipy.ndimage import median_filter
# 由于卷积核的大小一般是奇数,因此这里假设卷积核是奇数的
'''
####################
图像处理的基本函数
####################
'''... | StarcoderdataPython |
184862 | from ocdskit.cli.__main__ import main
from tests import assert_streaming
def test_command(capsys, monkeypatch):
assert_streaming(capsys, monkeypatch, main, ['split-record-packages', '1'],
['realdata/record-package_package.json'], ['realdata/record-package_split.json'])
| StarcoderdataPython |
3282272 | ''' A script to send all messages from one chat to another. '''
import asyncio
import logging
from telethon.tl.patched import MessageService
from telethon.errors.rpcerrorlist import FloodWaitError
from telethon import TelegramClient
from telethon.sessions import StringSession
from settings import API_ID, API_HASH, RE... | StarcoderdataPython |
1631334 | from src.appIndicator import AppIndicator
if __name__ == "__main__":
app = AppIndicator()
| StarcoderdataPython |
1758797 | <gh_stars>0
def word_to_weird_case(word):
return "".join([word[i].upper() if i%2==0 else word[i].lower() for i in range(len(word))])
def to_weird_case(string):
return " ".join([word_to_weird_case(word) for word in string.split()])
| StarcoderdataPython |
3352087 | <filename>batman/uq/cosi.py
"""
Cosine transformation indices
-----------------------------
<NAME>., How to compute variance-based sensitivity indicators with your
spreadsheet software, Environmental Modelling & Software,
2012. DOI: 10.1016/j.envsoft.2012.03.004
"""
import numpy as np
from scipy.fftpack import dct
d... | StarcoderdataPython |
76231 | <reponame>GeoStoner/Final-Project-Magnetite-Diffusion
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 20 11:59:58 2016
@author: ryanstoner
Model to calculate diffusion of He out of Magnetite at high diffusivities
relative to the production of He. Magnetite model from Blackburn et al. (2007)
Changing color in plot.
"""... | StarcoderdataPython |
22462 | <reponame>David-Ciz/kitt
import heapq
import logging
import os
from tensorflow.keras.callbacks import Callback
class ModelCheckpoint(Callback):
def __init__(
self,
filepath: str,
monitor: str,
mode: str = "max",
save_every_n_epochs: int = None,
save_n_best=1,
... | StarcoderdataPython |
4816412 | from functools import lru_cache
@lru_cache()
def rfa(*rfa_names):
""" award.rfa auditor condition factory
"""
def rfa_condition(value, system):
context = system['context']
award_uuid = context.upgrade_properties()['award']
rfa = _award_rfa(award_uuid, system['root'])
return... | StarcoderdataPython |
1667448 | # Generated by Django 3.0.3 on 2020-02-27 16:15
import autoslug.fields
from django.db import migrations
def migrate_data_forward(apps, schema_editor):
# see https://stackoverflow.com/a/37310620/330911
models = [
apps.get_model("erp", "Activite"),
apps.get_model("erp", "Cheminement"),
... | StarcoderdataPython |
36942 | import os
import time
from flask import Flask, render_template, request
from aws_requests_auth.aws_auth import AWSRequestsAuth
import requests
import uuid
import base64
import shutil
from config import Config
app = Flask(__name__)
config = Config()
@app.route("/", methods=["GET", "POST"])
def index():
if "uploa... | StarcoderdataPython |
1723817 | <filename>fib1.py
def fib1(n: int) ->int:
return fib1(n-1) + fib1(n-2)
if __name__ == "__main__":
print(fib1(5))
| StarcoderdataPython |
1694143 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Tools for acquiring and normalizing the content from BioDati's demo server."""
import json
import os
import click
import pybel.grounding
HERE = os.path.abspath(os.path.dirname(__file__))
NETWORK_ID = '01E46GDFQAGK5W8EFS9S9WMH12'
RAW_PATH = os.path.join(HERE, 'covid19-bioda... | StarcoderdataPython |
159259 | from statistics import mode
from typing import Tuple, List, Optional
from ._fixer_tool import FixerToolInterface
from ._languages import Languages
from ._sentence_pair import SentencePair
from .fixer_configurator import FixerConfigurator
from .fixer_statistics import FixerStatisticsMarks as StatisticsMarks
class Nam... | StarcoderdataPython |
3308823 | from osim.env import Arm2DEnv
import math
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from CEM_Agent import Agent
# Set up CUDA device
device = torch.device("cuda:0" if torch.cu... | StarcoderdataPython |
23582 | # -*- coding: utf-8 -*-
"""
Created on 2020/03/16
Feature selection: Relief-based feature selection algorithm.
------
@author: <NAME>
"""
import numpy as np
from sklearn import preprocessing
import os
from sklearn.externals import joblib
from el_classify_sensitive_person_train_validation import ClassifyFourKindOfPers... | StarcoderdataPython |
108288 | <filename>OpenGLCffi/GL/EXT/SGIS/point_parameters.py
from OpenGLCffi.GL import params
@params(api='gl', prms=['pname', 'param'])
def glPointParameterfSGIS(pname, param):
pass
@params(api='gl', prms=['pname', 'params'])
def glPointParameterfvSGIS(pname, params):
pass
| StarcoderdataPython |
157364 | import logging
from metadrive.component.road_network.node_road_network import NodeRoadNetwork
import numpy as np
from panda3d.core import TransparencyAttrib, LineSegs, NodePath
from metadrive.component.lane.circular_lane import CircularLane
from metadrive.component.map.base_map import BaseMap
from metadrive.component... | StarcoderdataPython |
4833827 | <filename>packages/postgres-database/src/simcore_postgres_database/migration/versions/64e91497d257_add_aborted_state.py
"""add aborted state
Revision ID: 64e91497d257
Revises: 27c6a30d7c24
Create Date: 2020-10-14 20:05:26.968038+00:00
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import ... | StarcoderdataPython |
3230476 | from ads import Ads, Project, Service, ServiceSet, Profile, BadSelectorException
| StarcoderdataPython |
3293767 | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from classification import parse_aug_fn
# Read Image
img_string = tf.io.read_file('./test/test_classification_image.jpg')
img = tf.image.decode_image(img_string)
img = img.numpy()
# Create dataset pipline
img_ds = tf.data.Dataset.from_tensor_... | StarcoderdataPython |
78702 | import cv2
from darcyai.perceptor.coral.people_perceptor import PeoplePerceptor
from darcyai.input.camera_stream import CameraStream
from darcyai.output.live_feed_stream import LiveFeedStream
from darcyai.pipeline import Pipeline
#Create a callback function for handling the input that is about to pass to the People P... | StarcoderdataPython |
1752472 | LAMBDA_FUNCION_CODE = """
import json
import boto3
from base64 import b64decode
def safeget(dct, *keys, default=None):
for key in keys:
try:
dct = dct[key]
except KeyError:
return default
return dct
def lambda_handler(event, context):
runtime = boto3.client('runtime... | StarcoderdataPython |
3295763 | <reponame>mdop-wh/pulumi-aws<gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping... | StarcoderdataPython |
42542 | <filename>setup.py
from setuptools import setup, find_packages
with open('requirements.txt') as requirements_file:
install_requirements = requirements_file.read().splitlines()
setup(
name="slack_utils",
version="0.0.1",
description="my slack utils",
author="mollinaca",
packages=find_packages(),
... | StarcoderdataPython |
7322 | import struct
import msgpack
from lbrynet.wallet.transaction import Transaction, Output
from torba.server.hash import hash_to_hex_str
from torba.server.block_processor import BlockProcessor
from lbrynet.schema.claim import Claim
from lbrynet.wallet.server.model import ClaimInfo
class LBRYBlockProcessor(BlockProce... | StarcoderdataPython |
1643538 | <reponame>varajala/microtest
"""
Utility functions for microtest.core that don't require any state.
Author: <NAME>
"""
import os
import functools
import inspect
from microtest.objects import Module, Types
def capture_exception(func: Types.Function) -> Types.Function:
@functools.wraps(func)
def wrapper(*ar... | StarcoderdataPython |
3328717 | <filename>face_tracking.py<gh_stars>1-10
# coding: utf-8
import picamera
import picamera.array
import cv2
import pigpio
import time
xsv = 25 #X軸サーボのPort番号
ysv = 24 #y軸サーボのPort番号
span = 300 #サーボのセンターからの可動範囲duty値
xct = 1550 #X軸サーボのセンターduty値
yct = 1490 #X軸サーボのセンターduty値
dly = 0.01 #サーボ駆動時のウェイト時間
stp = 2 #サーボ駆動時のdutyステ... | StarcoderdataPython |
4822327 | <gh_stars>0
from greenflow.dataframe_flow import Node, PortsSpecSchema
from greenflow.dataframe_flow.portsSpecSchema import ConfSchema
from greenflow.dataframe_flow.metaSpec import MetaDataSchema
from greenflow.dataframe_flow.template_node_mixin import TemplateNodeMixin
from ..node_hdf_cache import NodeHDFCacheMixin
_... | StarcoderdataPython |
3207438 | <filename>userbot/database/settings.py
from userbot.database import database
class Settings:
def __init__(self):
self.pm_table = database()['settings']
def set_pm_permit(self, status: bool):
self.pm_table.update_one({'key': 'pm_permit', 'value': status}, '')
| StarcoderdataPython |
1786273 | <reponame>maschmi/sparbahn
from bahn.bahn import Sparbahn, TripData
from datetime import datetime, timedelta, date
from alert.mailalert import Mailalert
def allweekdays(start_date, weekday, weeks):
"""generates the date for a given weekday for x weeks in the future starting from start_date"""
d = start_date ... | StarcoderdataPython |
171552 | with open("pokemon_list.txt", "r") as f:
pokemon_lista = f.readlines()
pokemon_lista = [elemento.strip('\n') for elemento in pokemon_lista]
import data as d
def validate(name, p_l = pokemon_lista, mensaje = d.validacion_pokemon()):
if name =='codigo-cero':
name = 'type-null'
while name not in ... | StarcoderdataPython |
1712694 | # Copyright 2011 Google 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 required by applicable law or agreed to in writing,... | StarcoderdataPython |
1624033 | # Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 of conditions and t... | StarcoderdataPython |
43201 | <filename>2021/d03/d03.py<gh_stars>0
#!/usr/bin/env python3
inp = []
with open('03.txt') as fp:
for line in fp:
inp.append(line.strip())
def part1(arr):
acc = [0] * len(arr[0])
for x in arr:
for i in range(len(x)):
acc[i] += int(x[i])
gamma = list(map(lambda x: '1' if x >=... | StarcoderdataPython |
3222325 | import sys
import unittest
from dynd import nd, ndt
if sys.version_info >= (3, 0):
unicode = str
@unittest.skip('Test disabled since callables were reworked')
class TestUnicode(unittest.TestCase):
def test_array_string(self):
a = nd.array("Testing 1 2 3")
self.assertEqual(nd.type_of(a), ndt.st... | StarcoderdataPython |
1678961 | <reponame>geickelb/mimiciii-antibiotics-modeling<filename>src/testing/testing_2.py<gh_stars>1-10
# Markdown and code chunks testing
This file is a test of pycharm's markdown and codecell support
#%%
import numpy as np
import matplotlib.pyplot as plt
#%% build a scatterplot
N = 50
x = np.random.rand(N)
y = np.random... | StarcoderdataPython |
3300449 | """Heap data structure example
Copyright 2017, <NAME>
"""
import random
"""Heap data structure
The 'max' property determines whether this is a max or min heap
"""
class Heap:
def __init__(self, property):
self.property = property
self.keys = []
def __repr__(self):
return "{} heap... | StarcoderdataPython |
1771265 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 11:12:10 2018
@author: avelinojaver
"""
import sys
from pathlib import Path
dname = Path(__file__).resolve().parents[1]
sys.path.append(str(dname))
from cell_localization.models import UNet
import torch
import numpy as np
import pandas as pd
i... | StarcoderdataPython |
1793522 | <filename>labs_challenge/apps.py
from django.apps import AppConfig
class LabsConfig(AppConfig):
name = 'labs_challenge'
| StarcoderdataPython |
1709319 | <reponame>ifm/ifm3d-ros2
#
# Copyright (C) 2019 ifm electronic, gmbh
#
# 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 app... | StarcoderdataPython |
1655658 | <filename>stitches/fx_stitch.py
# Import packages
import numpy as np
import pandas as pd
import pkg_resources
import xarray as xr
import os as os
import stitches.fx_util as util
import stitches.fx_data as data
import stitches.fx_pangeo as pangeo
def find_zfiles(rp):
""" Determine which cmip files must be downlao... | StarcoderdataPython |
3276152 | <filename>screen/display/display.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from importlib import import_module
from screen.custom import *
class Display:
def __init__(self, driver_name):
self.driver_name = driver_name
self.get_driver()
self.get_display_size()
def get_driver(... | StarcoderdataPython |
1721148 | #!/usr/bin/env python
# coding: utf-8
"""Clusterless Decoding Analysis W-Track | Compute decoded position and
distance metrics based on CA1 Marks and associated body position |
Inputs: Marks, Posdlc, Task, Tetinfo | https://github.com/edeno/pose_analysis
"""
import logging
import os
import numpy as np
import xarray a... | StarcoderdataPython |
3272347 | <gh_stars>0
# 克隆自聚宽文章:https://www.joinquant.com/post/669
# 标题:【回测来啦】——鳄鱼法则交易系统,15年至今114%
# 作者:陈小米。
import numpy as np
def initialize(context):
g.up_price = {} #向上碎形最高价
g.low_price = {} #向下碎形最低价
g.up_fractal_exists = {} #判断有效向上碎形
g.down_fractal_exists = {} #判断有效向下碎形
g.AO_index = {} #存放连续的AO指标数据
... | StarcoderdataPython |
3396882 | <reponame>mauricio-chavez/waitress-backend
"""Development settings."""
from .base import * # NOQA
from .base import env
from datetime import timedelta
# Base
DEBUG = env.bool('DJANGO_DEBUG', True)
# Security
SECRET_KEY = env(
'DJANGO_SECRET_KEY',
default='4ra7dxard(&tmw$b5s9--akuakuisreal0v4!!f_-h7i)b_96a... | StarcoderdataPython |
1768289 | from typing import List
import pytest
from thinc.api import fix_random_seed, Adam, set_dropout_rate
from thinc.api import Ragged, reduce_mean, Logistic, chain, Relu
from numpy.testing import assert_array_equal, assert_array_almost_equal
import numpy
from spacy.ml.models import build_Tok2Vec_model, MultiHashEmbed, Maxou... | StarcoderdataPython |
3381145 | <filename>qa_lib.py<gh_stars>0
import os
import shutil
import time
import pysftp
from PIL import Image
'''
TODO: Move folders from 002-ingest to 003-ingested
example:
sudo cp -R . /library/lib-sftp/003-ingested/P005_University_of_Denver_Clarion-resources_1194/
sudo cp -R . /library/lib-sftp/001-ready/new_000_qa_... | StarcoderdataPython |
3274313 | class NoContentError(RuntimeError):
pass
class DuplicateUploadError(RuntimeError):
pass
class ApiError(RuntimeError):
pass
class NotFoundError(ApiError):
pass
| StarcoderdataPython |
3218933 | """
test_newick
===========
Tests for the `newick` module.
"""
# Import the library being tested
import ngesh
def test_sorted_newick():
"""
Tests if sorted_newick() is returning the expected string.
"""
original_nw = "(Ei:0.98,(Mepale:0.39,(Srufo:0.14,Pulet:0.14):0.24):0.58);"
sorted_nw = "(((P... | StarcoderdataPython |
3391259 | # Python > Regex and Parsing > Re.findall() & Re.finditer()
# Find all the pattern matches using the expressions re.findall() and re.finditer().
#
# https://www.hackerrank.com/challenges/re-findall-re-finditer/problem
#
import re
found = False
s = input()
for i in re.findall("(?<=[^aeiou])([aeiou]{2,})[^aeiou]", s, f... | StarcoderdataPython |
4828885 | <gh_stars>10-100
# Copyright (c) Nanjing University, Vision Lab.
# <NAME> (<EMAIL>), <NAME> (<EMAIL>); Nanjing University, Vision Lab.
# Last update: 2020.06.06
import os
import sys
# sys.path.append('.')
import glob
import subprocess
import argparse
import logging
from time import time
import torch
import torch.utils... | StarcoderdataPython |
3239112 | <reponame>cameronfr/trusat-backend
#!/usr/bin/env python
"""
This is a script to rename files retrieved from John's hypermail scraper,
try and determine the date from the filename, and then rename the filename
with the successfully parsed date.
Note that I've had to do some manual cleanup both before and after this... | StarcoderdataPython |
4829032 | <reponame>HuaweiWang/GaitAnalysisToolKit<filename>gaitanalysis/tests/test_gait.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# builtin
import os
# external
import numpy as np
from numpy import testing
import pandas
from pandas.util.testing import assert_frame_equal
from nose.tools import assert_raises
# local
fro... | StarcoderdataPython |
1613677 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.base_blocks import BasicConv
class CEM(nn.Module):
"""Context Enhancement Module"""
def __init__(self, channels, fea_channel):
super(CEM, self).__init_... | StarcoderdataPython |
127886 | import zengl
class Context:
context = None
main_uniform_buffer = None
main_uniform_buffer_data = bytearray(b'\x00' * 64)
@classmethod
def initialize(cls):
ctx = zengl.context()
cls.context = ctx
cls.main_uniform_buffer = ctx.buffer(size=64)
ctx.includes['main_unifo... | StarcoderdataPython |
3355086 | <filename>utils/FastRotators/calc_rv.py
import pyfits
import argparse
import os
import spfr
import glob
from pylab import *
import pickle
parser = argparse.ArgumentParser()
parser.add_argument('directorio')
parser.add_argument('-pars',default='6000,4.5,0.0,100')
parser.add_argument('-model_path',default='../../data/CO... | StarcoderdataPython |
3216989 | import struct
import sys
from models import *
from utils.utils import *
size = sys.argv[3]
model_name = sys.argv[2]
model = Darknet('cfg/'+model_name, (size, size))
weights = sys.argv[1]
device = torch_utils.select_device('0')
if weights.endswith('.pt'): # pytorch format
model.load_state_dict(torch.load(weights, ... | StarcoderdataPython |
4816578 | <filename>IMAGE_EXP/train.py<gh_stars>1-10
import os
import pickle
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
import config as conf
import matplotlib.pyplot as plt
from models.gan import GAN
from models.nsgan import NSGAN
from models.dcgan import DCGAN
from models.wgan_gp import WGAN... | StarcoderdataPython |
1779663 | <gh_stars>0
# Write your solution here
word = input("Please type in a string: ")
sub = input("Please type in a substring: ")
i = 0
count = 0
while True:
index = word.find(sub)
if (index == -1):
print("The substring does not occur twice in the string.")
break
if (sub in word):
word = ... | StarcoderdataPython |
1606748 | <filename>DataLoaderTask/DataLoaderTask.py
# MIT License
# Copyright (c) 2020 <NAME> and <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 limita... | StarcoderdataPython |
78969 | '''
Objective function for hyperparameter optimization of an autoencoder with 3 hidden layers
Author(s): <NAME> (<EMAIL>)
'''
import pickle
import os
import sys
import ConfigParser
import numpy as np
from sklearn import preprocessing
from sklearn.cross_validation import KFold
sys.path.append('../..')
from deep_networ... | StarcoderdataPython |
3201618 | from __future__ import annotations # prevents NameError for typehints
from typing import List
from pydantic import BaseModel
from chatbot.schemas import OutMixin, QuestionIn, QuestionOut, Response
class SurveyBase(BaseModel):
"""Base schema for survey"""
name: str
class SurveyQuestionsIn(SurveyBase):
... | StarcoderdataPython |
1726854 | import gspread
from os.path import join, dirname,realpath
from oauth2client.service_account import ServiceAccountCredentials
import argparse
from config import google_credential_file
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_ke... | StarcoderdataPython |
125026 | <reponame>antoorofino/Emergence_in_complex_systems_EVOLIFE
#!/usr/bin/env python#!/usr/bin/python3
#!/usr/bin/env python3
##############################################################################
# EVOLIFE http://evolife.telecom-paris.fr <NAME> #
# Telecom Paris 2021 ... | StarcoderdataPython |
1625761 | <reponame>MauMendes/python-for-everybody<gh_stars>0
<<<<<<< HEAD
<<<<<<< HEAD
largest = None
smallest = None
while True:
num = input('Enter a number: ')
if num == "done" :
break
try:
ival = int(num)
except:
print("Invalid input")
if largest is None:
largest = ival
... | StarcoderdataPython |
55836 | <gh_stars>0
import string
import re
import numpy as np
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
exclude = set(string.punctuation)
stops = set(stopwords.words('english'))
def clean_document(doc, lang='en'):
clean_punc = ''.join(ch if ch not in exclude else ' ' ... | StarcoderdataPython |
3245221 | <gh_stars>10-100
from typing import Optional
from typing import Tuple
import tensorflow as tf
from tensorflow.keras import initializers
class Equidistant(initializers.Initializer):
"""
Initializer that generates tensors where the last axis is initialized with 'equidistant' values.
Args:
minval: A ... | StarcoderdataPython |
143210 | <reponame>pulumi/pulumi-kubernetes-crds
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... impor... | StarcoderdataPython |
123865 | # -*- coding: utf-8 -*-
"""
This module handle finding the be engine dll's
"""
# ---------------------------------------------------------------------------- #
# Include
# ---------------------------------------------------------------------------- #
import sys
import os
import logging
if sys.version_info < (3, 0):
... | StarcoderdataPython |
3275478 | <filename>old (ignore)/old/runner-old.py
#Sources:
#https://www.geeksforgeeks.org/reading-excel-file-using-python/
#https://developers.google.com/calendar/v3/reference
from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthli... | StarcoderdataPython |
3387567 | """Embedding with Tensorflow1"""
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
def find_embedding(graph, dimension, max_steps=1000):
"""Tries to embed given graph in given dimension.
Args:
graph: the graph, in which every edge is assumed to have a 'sign'
... | StarcoderdataPython |
4832039 | """
Django settings for tsadm project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | StarcoderdataPython |
3377391 | # -*- coding: utf-8 -*-
"""
Created Date: 2021-03-22 Am
@author: XiaoQingLin
"""
import getopt
import sys
from binary_python.binary_python import start_binary_encrypt
def usage():
"""
python代码 加密|加固
参数说明:
-i | --input_file_path 待加密文件或文件夹路径,可是相对路径或绝对路径
-o | --output_file_path 加密后的文件输出... | StarcoderdataPython |
1659860 | import requests
import json
import uuid
import boto3
client = boto3.client('rekognition')
# store each person by a uuid instead of by name
uuid_to_person_map = {}
photo_link = ("https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/"
"Official_portrait_of_Vice_President_Joe_Biden.jpg/"
... | StarcoderdataPython |
1733555 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-26 10:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('query', '0023_auto_20181026_1010'),
]
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.