id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
4867699
<gh_stars>0 import multiprocessing import os import h5py from utils.image_preprocess import Deepphys_preprocess_Video, PhysNet_preprocess_Video from utils.text_preprocess import Deepphys_preprocess_Label, PhysNet_preprocess_Label def preprocessing(save_root_path: str = "/media/hdd1/dy/dataset/", ...
StarcoderdataPython
3546454
import numpy as np import heapq import random from itertools import count import torch class Transition_tuple(): def __init__(self, state, action, action_mean, reward, curiosity, next_state, done_mask, t): #expects as list of items for each initalization variable self.state = np.array(state) ...
StarcoderdataPython
1802337
import paramiko import time ip = '172.16.17.32' username = 'pyclass' password = '<PASSWORD>' remote_conn=paramiko.SSHClient() # avoid issues with not trusted targets remote_conn.set_missing_host_key_policy(paramiko.AutoAddPolicy()) remote_conn.connect(ip, username=username, password=password, look_for_keys=False, ...
StarcoderdataPython
6429870
<filename>setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup, find_packages MIDDLEWARE_BASE_DIR = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(MIDDLEWARE_BASE_DIR, 'README.md')) as f: long_description = f.read() setup( name='shein-django-jaeger...
StarcoderdataPython
8102501
<gh_stars>100-1000 from .models import Account DB_HOST = ["localhost"] DB_PORT = 27017 def get_db(db_name): import pymongo DB_HOST = ["localhost"] DB_PORT = 27017 db = pymongo.Connection(DB_HOST, DB_PORT)[db_name] return db def get_mongo_cursor(db_name, collection_name, max_docs=100): impo...
StarcoderdataPython
11303754
<filename>osm_validator/osm_change.py from datetime import datetime from io import BytesIO from lxml import etree class Node(object): __slots__ = ('id', 'version', 'timestamp', 'uid', 'user', 'changeset', 'lat', 'lon', 'tags') def __init__(self, *, id, version, timestamp, uid, user, changeset, lat, lon, tag...
StarcoderdataPython
8140955
print('===== 061 =====') t1 = float(input('digite o primeiro termo: ')) r = float(input('digite a razão: ')) cont = 1 t = t1 while cont <= 10: print(f'{int(t)}', end=' ') cont += 1 t += r print('FIM')
StarcoderdataPython
6642174
<gh_stars>0 import pytest from ppb.errors import BadChildException from ppb.gomlib import GameObject, Children class TestEnemy: pass class TestPlayer: pass class TestSubclassPlayer(TestPlayer): pass class TestSprite: pass def containers(): yield GameObject() def players(): yield Te...
StarcoderdataPython
191758
<reponame>eva-koester/tuberculosis import pandas as pd import cleaning import matplotlib.pyplot as plt import seaborn as sns df = cleaning.load_clean_data() df['age'] = df['age'].replace([1], 14) #print(df) # sum of value per age age = df.groupby('age')['value'].sum() age=pd.DataFrame(age) age=age.reset_index() print...
StarcoderdataPython
3263540
<gh_stars>0 from unittest.mock import patch from django.test import TestCase from bookwyrm import models, incoming class IncomingFollow(TestCase): def setUp(self): with patch('bookwyrm.models.user.set_remote_server.delay'): with patch('bookwyrm.models.user.get_remote_reviews.delay'): ...
StarcoderdataPython
3417435
from unittest import TestCase from icon_microsoft_teams.connection import Connection import json import logging class TestConnection(TestCase): def test_connection(self): log = logging.getLogger("Test") test_conn = Connection() test_conn.logger = log with open("../tests/send_messa...
StarcoderdataPython
331458
<gh_stars>1-10 # coding: utf-8 # # Mask R-CNN Demo # # A quick intro to using the pre-trained model to detect and segment objects. # In[1]: import os import sys import random import math import numpy as np import skimage.io import matplotlib import matplotlib.pyplot as plt # Root directory of the project ROOT_DI...
StarcoderdataPython
11226261
<reponame>samialabed/rlgraph # Copyright 2018/2019 The RLgraph authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
StarcoderdataPython
9719689
<filename>ompclib/ompclib_numpy.py # This file is a part of OMPC (http://ompc.juricap.com/) # # for testing: # import ompclib_numpy; reload(ompclib_numpy); from ompclib_numpy import * # TODO # - remove all references to array, use "ompc_base._init_data" instead import sys, os; sys.path.append(os.path.absp...
StarcoderdataPython
215036
<reponame>MakaronKanon/infi.devicemanager __import__("pkg_resources").declare_namespace(__name__) from contextlib import contextmanager from infi.exceptools import chain from .setupapi import functions, properties, constants from infi.pyutils.lazy import cached_method from logging import getLogger ROOT_INSTANCE_ID = ...
StarcoderdataPython
8137
import sys from matplotlib import image as mpimg import numpy as np import os DIPHA_CONST = 8067171840 DIPHA_IMAGE_TYPE_CONST = 1 DIM = 3 input_dir = os.path.join(os.getcwd(), sys.argv[1]) dipha_output_filename = sys.argv[2] vert_filename = sys.argv[3] input_filenames = [name for nam...
StarcoderdataPython
4812025
<gh_stars>0 # -*- coding: utf-8 -*- """ pip_services3_commons.refer.References ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Referencescomponent implementation :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ im...
StarcoderdataPython
8158851
<reponame>Martin-Jia/words-app<filename>app.py from flask import Flask, request import logging from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth from threading import Timer import random import string import datetime from Utils.constants import Constants, ErrorCode, ErrorMessage import jwt from Utils.db_helper im...
StarcoderdataPython
9707897
from django.db import models from ckeditor_uploader.fields import RichTextUploadingField # Create your models here. class Product(models.Model): category = models.ManyToManyField('products.ProductCategory', related_name='product_category') tag = models.ManyToManyField('products.Tag', rela...
StarcoderdataPython
3428170
<gh_stars>1-10 helpstring = "voiceme" arguments = ["self", "info", "args"] minlevel = 3 def main(connection, info, args) : """Voices the sender""" connection.rawsend("MODE %s +v %s\n" % (info["channel"], info["sender"]))
StarcoderdataPython
4819184
<reponame>jerroydmoore/YARB ''' Agent Created on Jan 28, 2011 @author: yangwookkang ''' import time import utils import sys from nlu.NLparser import NLparser from nlg.NLgenerator import NLgenerator from dm.dialogmanager import DialogManager from datetime import date from dm.imdb_wrapper import IMDBWrapper from dm.l...
StarcoderdataPython
6700794
''' Created on Jan 10, 2012 @author: tjhunter All the data structures as used in the python files. ''' class Coordinate(object): """ A geolocation representation. """ def __init__(self, lat, lng): self.lat = lat self.lon = lng def __eq__(self, other): return self.lat == other.lat...
StarcoderdataPython
6457591
<reponame>fei-protocol/checkthechain from .crud import *
StarcoderdataPython
6551233
<gh_stars>1-10 from random import * from math import * def rumus (x1, x2) : return ((2 * (pow(x1,2)) + pow(x2,4)/3) * (pow(x1,2)))-(x1 * x2) + (4 * (pow(x2,2)) * (pow(x2,2))) def rand () : return uniform(-1,1) def key (dE, T) : return exp(-dE/T) x1 = rand() x2 = rand() CurrentState = rumus(x...
StarcoderdataPython
3207711
# Imports from 3rd party libraries import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output # Imports from this application from app import app from joblib import load pipeline = load('assets/pipeline.joblib'...
StarcoderdataPython
1855652
<reponame>bmorris3/mosfire_wasp6 # -*- coding: utf-8 -*- """ Created on Sat Jan 31 08:56:57 2015 @author: bmmorris """ import numpy as np from matplotlib import pyplot as plt def gelmanrubin(samples, **kwargs): ''' The Gelman-Rubin (1992) statistic R-hat. Parameters ---------- samples : ...
StarcoderdataPython
3286631
<gh_stars>1-10 def sum_finding_dfs(nums, target): frontier = [(0, [])] while frontier: partial_sum, nums_so_far = frontier.pop() if partial_sum == target: yield nums_so_far continue if partial_sum > target: continue for num in nums: ...
StarcoderdataPython
4877403
# The MetaCommand Cog, which handles all batch commands. import os import discord as dc from discord.ext import commands from cogs_textbanks import url_bank, query_bank, response_bank from bot_common import bot, CONST_AUTHOR, user_or_perms _cmd_dir = 'cmd' class BatchCommands(commands.Cog): def __init__(self, ...
StarcoderdataPython
8007538
from enum import Enum class FilingType(Enum): """Available filing types to be used when creating Filing object. .. versionadded:: 0.1.5 """ FILING_1 = '1' FILING_1A = '1-a' FILING_1E = '1-e' FILING_1K = '1-k' FILING_1N = '1-n' FILING_1SA = '1-sa' FILING_1U = '1-u' FILING_...
StarcoderdataPython
6551062
#%% import tensorflow as tf import tensorflow.keras as K from tensorflow.keras import layers #%% def build_encoder(PARAMS): x = layers.Input((PARAMS['data_dim'], PARAMS['data_dim'], PARAMS['channel'])) dims = [8, 16, 32, 64] skip = x for i in range(PARAMS['n_layer']): skip = layers.Conv2D(f...
StarcoderdataPython
65040
<reponame>smartx-jshan/Coding_Practice<gh_stars>0 class MyCircularQueue: def __init__(self, k: int): self.q = [None] * k self.maxlen = k self.front = 0 self.rear = 0 def enQueue(self, value: int) -> bool: if self.q[self.rear] is None: self.q[self.re...
StarcoderdataPython
11243665
import typing class UnionFind(): def __init__( self, n: int, ) -> typing.NoReturn: self.__a = [-1] * n def find( self, u: int, ) -> int: a = self.__a if a[u] < 0: return u a[u] = self.find(a[u]) return a[u] def unite( self, u: int, v: int, ) -> ty...
StarcoderdataPython
82714
<gh_stars>0 #!/usr/bin/env """ GOA_Winds_StormPatterns.py Compare Gorepoint/globec winds (along shore) to telleconnection indices GorePoint - 58deg 58min N, 150deg 56min W and Globec3 59.273701N, 148.9653W Files are created by GOA_Winds_NARR_model_prep.py -Filtered NARR winds with a triangular filter...
StarcoderdataPython
6459651
<reponame>yanweiqiang/scrapingBook<gh_stars>0 from urllib.request import urlopen from urllib.error import HTTPError from urllib.error import URLError from bs4 import BeautifulSoup myUrl = "http://www.pythonscraping.com/pages/page1.html" def get_title(url): title = "" try: html = urlopen(url) ...
StarcoderdataPython
5009976
<reponame>iamjavaexpert/Kamodo import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) from kamodo.kamodo import * from kamodo.util import *
StarcoderdataPython
9605711
from enum import Enum class HomologyTypes(Enum): """ Core homology relations from RO """ Ortholog = 'RO:HOM0000017' LeastDivergedOrtholog = 'RO:HOM0000020' Homolog = 'RO:HOM0000007' Paralog = 'RO:HOM0000011' InParalog = 'RO:HOM0000023' OutParalog = 'RO:HOM0000024' Ohnolog = 'RO...
StarcoderdataPython
315977
from typing import Dict, List import requests_cache from afacinemas_scraper.core.cinemas import ScraperCinemas from afacinemas_scraper.core.lancamentos import ScraperLancamentos from afacinemas_scraper.core.precos import ScraperPrecos requests_cache.install_cache( "cache_afacinemas", backend="sqlite", expire_aft...
StarcoderdataPython
373472
<gh_stars>1-10 #!/usr/bin/env python import settings from pymclevel import MCInfdevOldLevel from pymclevel import TileEntity try: TileEntity.baseStructures['Control'] except KeyError: from pymclevel import nbt TileEntity.baseStructures['Control'] = ( ('Command', nbt.TAG_String), ('LastOutpu...
StarcoderdataPython
11359261
from typing import TYPE_CHECKING if TYPE_CHECKING: from pineboolib.fllegacy.flformdb import FLFormDB from PyQt5 import QtWidgets def AQFormDB(action_name: str, parent: "QtWidgets.QWidget") -> "FLFormDB": """Return a FLFormDB instance.""" from pineboolib.application.utils.convert_flaction import conv...
StarcoderdataPython
11372477
<filename>Homework/Dijkstra.py # -*- coding: utf-8 -*- """ Created on Fri Sep 27 13:08:39 2019 @author: wenbin """ """ this program is the algotithm of dijkstra 注意:本代码的中的节点就是list数组的index,为了和python保持一致,因此下标从0开始,若题目为从1开始,则可将父节点的下标+1 """ class Dijkstra(): def __init__(self , AdjacencyMatrix , StartVert...
StarcoderdataPython
126875
<gh_stars>10-100 #!/usr/bin/env python ######################################################################## # Copyright 2012 Mandiant # Copyright 2014 FireEye # # Mandiant licenses this file to you under the Apache License, Version # 2.0 (the "License"); you may not use this file except in compliance with the # Lic...
StarcoderdataPython
1681783
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython
6496594
<gh_stars>1-10 import os import pytest from app.movie import format_movie_year_min from app.movie import format_vote_average from app.movie import format_runtime_min from app.movie import format_runtime_max from app.movie import format_movie_certification from app.movie import genre_string_to_id from app.movie import r...
StarcoderdataPython
1977048
#! /usr/bin/env python import geometry_msgs.msg import rospy import tf2_ros if __name__ == '__main__': """ Broadcast a transform from parent_frame to target_frame forever, with changing translation. """ rospy.init_node('dummy_transform_publisher', anonymous=True) br = tf2_ros.TransformBroadcas...
StarcoderdataPython
8195012
<filename>Number_LetterToHexAndBin.py import time while True: user_input = input("Enter a letter: ") letter_as_num = ord(user_input) time.sleep(1) print("Decimal: {:d}".format(letter_as_num)) print("Hexadecimal: {:02x}".format(letter_as_num)) time.sleep(0.76) print("*****...
StarcoderdataPython
5074938
<filename>back/simulador/__init__.py from .event import * from .model import * from .process import * from .simulation import * from .simulator import *
StarcoderdataPython
9780533
""" A module that contains a metaclass mixin that provides NumPy ufunc overriding for an ndarray subclass. """ import numpy as np from ._calculate import CalculateMeta from ._lookup import LookupMeta class UfuncMeta(LookupMeta, CalculateMeta): """ A mixin class that provides the basics for compiling ufuncs. ...
StarcoderdataPython
25028
<reponame>VagnerGit/PythonCursoEmVideo<filename>desafio_005_antecessor_e_sucessor.py """ Exercício Python 5: Faça um programa que leia um número Inteiro e mostre na tela o seu sucessor e seu antecessor. """ n = int(input('digite um numero inteiro ')) #ant = n-1 #post = n+1 #print('O antecessor de {} é {} e posterior é...
StarcoderdataPython
9658600
# This file was auto generated; Do not modify, if you value your sanity! import ctypes import enum from ics.structures.s_phy_reg_pkt_clause22_mess import * from ics.structures.s_phy_reg_pkt_clause45_mess import * class Nameless9872(ctypes.Structure): _fields_ = [ ('Enabled', ctypes.c_uint16, 1), ...
StarcoderdataPython
1942577
<gh_stars>0 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'dialog_Radius.ui' # # Created by: PyQt5 UI code generator 5.14.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog_Radius(object): def setupUi(self, Dialog...
StarcoderdataPython
1666602
<gh_stars>1-10 from hodgepodge.click import str_to_ints, str_to_strs import click import hodgepodge.processes @click.group() def processes(): """ Query processes. """ @processes.command() @click.option('--pids') @click.option('--ppids') @click.option('--names') @click.option('--hide-empty-values/--show...
StarcoderdataPython
9608033
<reponame>StabbarN/faker<filename>faker/providers/currency/es_ES/__init__.py<gh_stars>10-100 from .. import Provider as CurrencyProvider class Provider(CurrencyProvider): # Format: (code, name) currencies = ( ("AED", "Dírham de los Emiratos Árabes Unidos"), ("AFN", "Afghaní"), ("ALL", ...
StarcoderdataPython
8151329
from torch.nn import L1Loss from hyperverlet.loss import TimeDecayMSELoss, MeanNormLoss def construct_loss(train_args): criterion = train_args['criterion'] if criterion == 'TimeDecayMSELoss': time_decay = train_args["time_decay"] return TimeDecayMSELoss(time_decay) else: losses =...
StarcoderdataPython
6632004
<reponame>Valisback/hiring-engineers<gh_stars>0 # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019-Present Datadog, Inc. from datadog_api_client.v1.model_utils...
StarcoderdataPython
9666753
<filename>src/utils.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (C) 2020, <NAME> <<EMAIL>> # All rights reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of...
StarcoderdataPython
24282
<filename>torch_glow/tests/nodes/quantized_batchnorm3d_relu_test.py<gh_stars>1-10 from __future__ import absolute_import, division, print_function, unicode_literals import unittest import torch import torch.nn as nn from tests.utils import jitVsGlow from torch.quantization import ( DeQuantStub, QConfig, Q...
StarcoderdataPython
137505
from django.contrib import admin from .models import Category, Post admin.site.register(Post) admin.site.register(Category)
StarcoderdataPython
12803561
from collections import OrderedDict import dash_html_components as html import dash_core_components as dcc import dash_table from dash.dependencies import Input, Output from server import app, server from tutorial import chapter_index from tutorial import home def create_contents(contents): h = [] for i i...
StarcoderdataPython
8143204
import numpy as np def test_big_2D_image(viewer_factory): """Test big 2D image with axis exceeding max texture size.""" view, viewer = viewer_factory() shape = (20_000, 10) data = np.random.random(shape) layer = viewer.add_image(data, is_pyramid=False) visual = view.layer_to_visual[layer] ...
StarcoderdataPython
1840179
#!/usr/bin/env python # -*- coding: utf-8 -*- import re def is_only_numeric(s, *args, **kwargs): """ True if string `s` contains nothing but numbers (and whitespace) >>> is_only_numeric('Hi there') False >>> is_only_numeric('Number 9') False >>> is_only_numeric('42') True >>> i...
StarcoderdataPython
4826567
<filename>test/test_format.py from datetime import datetime, timezone from typing import Any, Dict import pytest from versioningit.basics import basic_format from versioningit.core import VCSDescription from versioningit.errors import ConfigError BUILD_DATE = datetime(2038, 1, 19, 3, 14, 7, tzinfo=timezone.utc) @pyt...
StarcoderdataPython
11249274
default_app_config = 'autodrp.apps.AutoDRPConfig'
StarcoderdataPython
3442805
#71 编写input()和output()函数输入,输出5个学生的数据记录 student = [] def input_stu(stu, num): for i in range(5): stu.append(['', '', []]) for i in range(num): stu[i][0] = input('input the num:\n') stu[i][1] = input('input the name:\n') for j in range(2): stu[i][2].append(int(inp...
StarcoderdataPython
6595024
<filename>linear_model/model_pick/random_forest/triplets_wei.py<gh_stars>0 import copy import itertools import re import sys from difflib import SequenceMatcher import numpy as np import pandas as pd import scipy import statsmodels.formula.api as sm global tax_thr tax_thr = 0 class Graph: def __init__(self): ...
StarcoderdataPython
3300151
from federatedml.feature.fate_element_type import NoneType from operator import itemgetter from federatedml.param.evaluation_param import EvaluateParam from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import BoostingTreeModelMeta from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import O...
StarcoderdataPython
6553748
# # Generated with SNCurveItemBlueprint from dmt.blueprint import Blueprint from dmt.dimension import Dimension from dmt.attribute import Attribute from dmt.enum_attribute import EnumAttribute from dmt.blueprint_attribute import BlueprintAttribute from sima.sima.blueprints.moao import MOAOBlueprint class SNCurveItemB...
StarcoderdataPython
6577440
#!/usr/bin/env python from scipy import * from scipy.linalg import * import utils import os, re, sys def Print(Us): for i in range(shape(Us)[0]): print ' ', for j in range(shape(Us)[1]): print "%11.8f " % Us[i,j], print def Get_BR1_DIR(case): file = case+'.outputd' fou...
StarcoderdataPython
193316
from __future__ import print_function import os import sys import re import ssg.build_yaml languages = ["anaconda", "ansible", "bash", "oval", "puppet", "ignition"] lang_to_ext_map = { "anaconda": ".anaconda", "ansible": ".yml", "bash": ".sh", "oval": ".xml", "puppet": ".pp", "ignition": ".y...
StarcoderdataPython
3454519
<gh_stars>1-10 #%% """ - Find the Difference - https://leetcode.com/problems/find-the-difference/ - Easy Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Examp...
StarcoderdataPython
3546252
<filename>lib/tf_colormap.py import numpy as np import tensorflow as tf import matplotlib.cm def tf_cmap_nearest(data, map, min_val=0., max_val=1.): map = matplotlib.cm.get_cmap(map).colors map = tf.constant(map, dtype=tf.float32) data = tf.clip_by_value(data, min_val, max_val) #normalize to [0,1] d...
StarcoderdataPython
3221525
"""Data loader""" import os import torch import utils import random import numpy as np from transformers import BertTokenizer class DataLoader(object): def __init__(self, data_dir, bert_class, params, token_pad_idx=0, tag_pad_idx=-1): self.data_dir = data_dir self.batch_size = params.batch_size ...
StarcoderdataPython
5074583
# Generated by Django 2.2 on 2020-02-18 15:36 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import resource_inventory.models def clear_resource_bundles(apps, schema_editor): ResourceBundle = apps.get_model('resource_inventory', 'ResourceBundle') fo...
StarcoderdataPython
4916378
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by roadhump # Copyright (c) 2014 roadhump # # License: MIT # """This module exports the Ember Template Linter plugin class.""" import json import logging import os import re from SublimeLinter.lint import NodeLinter ...
StarcoderdataPython
1835940
<reponame>dmsgago/ree<gh_stars>0 from __future__ import unicode_literals from django.db import models # Create your models here. class Empresas(models.Model): cif = models.CharField(max_length=9, blank=True, primary_key=True) nombre = models.CharField(max_length=25, blank=True) def __str__(self): ...
StarcoderdataPython
6539106
<filename>src/app/models/employee.py from datetime import datetime from typing import Optional from pydantic import BaseModel class Employee(BaseModel): id: int first_name: str second_name: str date_of_birth: datetime gender: bool email: str salary: int position: str hired_on: dat...
StarcoderdataPython
3249066
<reponame>xtreme3d/xtreme3d import time import ctypes import sdl2 from keycodes import * def windowHandle(sdlwnd): info = sdl2.SDL_SysWMinfo() sdl2.SDL_GetWindowWMInfo(sdlwnd, ctypes.byref(info)) return info.info.win.window def textRead(filename): f = open(filename, 'r') return f.read() ...
StarcoderdataPython
3457509
import time from plyer import notification if __name__ == "__main__": while True: notification.notify( title = "DRINK WATER !!", message = "Just a gentle reminder for you - You need to drink water right now.", app_icon = "Related files/glassicon.ico", ...
StarcoderdataPython
369459
import django.utils.safestring from django import template from django.utils.translation import gettext_lazy as _ register = template.Library() @register.filter def copyable(value): value = str(value) if '"' in value: return value title = str(_("Copy")) return django.utils.safestring.mark_saf...
StarcoderdataPython
8005099
# Copyright 2017 AT&T Intellectual Property. All other rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
StarcoderdataPython
256335
import sys from typing import Optional import dataclasses from numba.core.types.functions import _ResolutionFailures import numpy as np from numba import njit, config from numba.extending import overload from numba.core.types import StructRef, intc, float64 from numba.experimental import structref from csr import CSR ...
StarcoderdataPython
5030360
<filename>test.py import json import os def read_json(): with open('data.json', encoding='utf-8') as read_file: data = json.load(read_file) return data def g_line(n, line): tmp = "N{0} {1}\n".format(str(n).zfill(2), line) return tmp def get_points(fl, fw, fm): # --> crutch :) fm2 = fm if fw == ...
StarcoderdataPython
3254531
<filename>membership/test_utils.py # -*- coding: utf-8 -*- import logging from random import Random # Use predictable random for consistent tests random = Random() random.seed(1) logger = logging.getLogger("membership.test_utils") from membership.models import Membership, Contact # We use realistic names in test d...
StarcoderdataPython
11326511
<gh_stars>1-10 from db_file_storage.model_utils import delete_file_if_needed, delete_file from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from django.utils.translation import gettext_lazy as _ class CardLevel(models.Model): """ Card Level. """ clas...
StarcoderdataPython
6568637
<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torchvision from torchvision import datasets, transforms import torch.nn.functional as F import torch.optim as optim import models as mdl import numpy as np import argparse imp...
StarcoderdataPython
5186581
<filename>wagtail/wagtailcore/views.py from django.http import Http404 def serve(request, path): # we need a valid Site object corresponding to this request (set in wagtail.wagtailcore.middleware.SiteMiddleware) # in order to proceed if not request.site: raise Http404 path_components = [compo...
StarcoderdataPython
1804405
<reponame>ohsu-comp-bio/ccc_client<gh_stars>0 import argparse from ccc_client.app_repo.AppRepoRunner import AppRepoRunner from ccc_client.utils import print_API_response def run(args): runner = AppRepoRunner(args.host, args.port, args.authToken) r = runner.update_metadata(args.imageId, args.metadata) pri...
StarcoderdataPython
11267489
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # main.py # (c) <NAME> 2018 # <EMAIL> from requests_html import HTMLSession import sys import time import os import configparser config_name = "Settings" vkapiuri_tag = "VKAPIURI" accesstoken_tag = "ACCESSTOKEN" version_tag = "VKAPIVERSION" def check_user(ids): TA...
StarcoderdataPython
3345617
<filename>OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/OES/read_format.py '''OpenGL extension OES.read_format This module customises the behaviour of the OpenGL.raw.GL.OES.read_format to provide a more Python-friendly API Overview (from the spec) This extension provides the capability to query an Op...
StarcoderdataPython
3476255
<filename>eslearn/utils/multiprocessing_test.py # -*- coding: utf-8 -*- """ Created on Tue Dec 4 22:41:05 2018 @author: lenovo """ from concurrent.futures import ThreadPoolExecutor import time # 参数times用来模拟网络请求的时间 def get_html(times): time.sleep(times) print("get page {}s finished\n".format(times)) re...
StarcoderdataPython
3496819
<gh_stars>1-10 # Always prefer setuptools over distutils from setuptools import setup setup( name="mattermostwrapper", packages=['mattermostwrapper'], version="2.2", author="<NAME>", author_email="<EMAIL>", url='https://github.com/btotharye/mattermostwrapper.git', download_url='https://gi...
StarcoderdataPython
1707353
<gh_stars>10-100 import unittest from policytool import policyutil class TestValidatePolicy(unittest.TestCase): def test_validate_policy_with_ok_input(self): policy = { "service": "service_tag", "name": "test_policy_rule", "policyType": 0, "description": "...
StarcoderdataPython
6403399
from .. import auth, models from flask import Blueprint, g, make_response, render_template import json login_auth = Blueprint('login_auth', __name__) # This blueprint handles RESTful API authentication and token generation. @auth.error_handler def unauthorized(): return make_response("""<!DOCTYPE HTML PUBLIC "-/...
StarcoderdataPython
3422575
# -*- encoding: utf-8 -*- """ :copyright: 2017-2020 H2O.ai, Inc. :license: Apache License Version 2.0 (see LICENSE for details) """ def load_pkl(name): """Load xgboost model from pickle and perform conversion from version 0.90 if necessary. :return: XGBoost model """ import pickle i...
StarcoderdataPython
6668214
<reponame>fortminors/msai-python from django import forms class LeadForm(forms.Form): name = forms.CharField(label='Your name', max_length=100) email = forms.EmailField(label='Email', max_length=100)
StarcoderdataPython
3424194
# Copyright 2020 LMNT, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
StarcoderdataPython
11367370
# Copyright 2019 U.C. Berkeley RISE Lab # # 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 agree...
StarcoderdataPython
3279684
<reponame>csadsl/poc_exp #!/usr/bin/evn python #-*-:coding:utf-8 -*- #Author:404 #Name:政府采购系统通用型任意用户密码获取漏洞 #Refer:http://www.wooyun.org/bugs/wooyun-2014-076710 def assign(service,arg): if service=="zfcgxt": return True,arg def audit(arg): url=arg+"UserSecurityController.do?method=...
StarcoderdataPython
6509159
<reponame>datalogics-kam/conan-package-tools<gh_stars>0 class Uploader(object): def __init__(self, conan_api, remote_manager, auth_manager, printer): self.conan_api = conan_api self.remote_manager = remote_manager self.auth_manager = auth_manager self.printer = printer def up...
StarcoderdataPython
4903645
""" Generates Figure 2a of the the paper <NAME>, <NAME>, and <NAME>. Non-smooth secondary source distributions in wave field synthesis. In German Annual Conference on Acoustics (DAGA), March 2015. Sound field synthesized by a semi-infintely rectangular array driven by two-dimensional WFS for a vir...
StarcoderdataPython
5093695
# -*- coding: utf-8 -*- # File generated according to PCondType12.ui # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_PCondType12(object): def setupUi(self, PCondType12): PCondType12.setObjectName("PCondType12") PCondType12.resize(965, 67...
StarcoderdataPython