id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1776364
<reponame>lumichatbot/experiment TRANSLATE_URL = 'http://0.0.0.0:5000/webhook' DEPLOY_URL = 'http://172.17.0.2:5000/deploy' TRANSLATE_API_TEMPLATE = '''{ "id": "28419e8b-2ce2-4587-84b2-98be5c49739d", "timestamp": "2018-05-29T18:39:06.145Z", "lang": "en", "result": { "source": "agent", "resolvedQuery": ...
StarcoderdataPython
64200
''' Author: <NAME> Description: Autocolorization ''' import cv2 image = cv2.imread('data/original.png') cv2.imshow('original',image) cv2.waitKey(0) cv2.destroyAllWindows() image = cv2.cvtColor(image, cv2.COLOR_BGR2LAB) cv2.imshow('lab',image) cv2.waitKey(0) cv2.destroyAllWindows() cv2.imshow('lab2b...
StarcoderdataPython
99580
## Hash table # Idea: A smaller dynamic direct access array # Reference implementation: #MIT Introduction to Algorithms, Recitation 4 # https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-spring-2020/lecture-notes/MIT6_006S20_r04.pdf from random import randint S...
StarcoderdataPython
119479
<filename>testSpace.py<gh_stars>0 #working from __future__ import print_function import tensorflow as tf import pandas as pd import numpy as np data=pd.read_csv("/home/ecotine/Desktop/presentDS/BreastCancer.csv") data["diagnosis"]= data["diagnosis"].map({'M':1,'B':0}) data.drop('id',axis=1,inplace=True) data=data.reind...
StarcoderdataPython
110329
<filename>quickJSON.py """ quickJSON A basic, simple Python module that interfaces with JSON files. """ # Imports import json class JSONManager: """Manages JSON files""" def __init__(self, filename = None): self.filename = filename if self.filename != None: ...
StarcoderdataPython
3212191
#!/usr/bin/python3 import sys import os import json from importlib import import_module handler_function = os.getenv("LAMBDA_HANDLER_FUNCTION") function_name = os.getenv("LAMBDA_FUNCTION_NAME") logfile = os.getenv("BOOTSTRAP_LOG_FILE") log = open(logfile, 'w') handler_file_name = "code." + ".".join(handler_function....
StarcoderdataPython
129791
<filename>vwoptimizelib/third_party/networkx/classes/digraph.py """Base class for directed graphs.""" # Copyright (C) 2004-2015 by # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # All rights reserved. # BSD license. from copy import deepcopy from ...networkx.classes.graph import Graph from ....
StarcoderdataPython
3281382
#request class MediaRequest(object): __slots__ = ['gatewayobj'] def __init__(self, gatewayobj): self.gatewayobj = gatewayobj def call(self, channelID, guildID=None, mute=False, deaf=False, video=False): self.gatewayobj.send( { "op": self.gatewayobj.OPCODE.VOICE_STATE_UPDATE, "d": { ...
StarcoderdataPython
1776817
from kv1_811 import * from inserter import insert,version_imported,reject from bs4 import BeautifulSoup import urllib2 from datetime import datetime,timedelta from htm import setLineColors,cleanDest,generatePool import logging from settings.const import * logger = logging.getLogger("importer") def getDataSource(): ...
StarcoderdataPython
114658
#!/usr/bin/env python3 """ A script to monitor folders and subdirectories for file movement, creation or modification so that files are automatically converted from predefined filetypes to target filetypes set by the user. Zamzar API keys can be obtained by registering at: https://developers.zamzar.com...
StarcoderdataPython
62629
<filename>lib/logger.py from os import environ from loguru import logger from sentry_sdk import capture_exception def info(msg: str): logger.info(msg) def error(exception: Exception): logger.exception(exception) # to trigger error alerts if environ.get("STAGE") == "prod": capture_exception...
StarcoderdataPython
127374
<filename>src/teamboard/migrations/0002_auto_20180822_0812.py # Generated by Django 2.1 on 2018-08-22 08:12 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('teamboard', '0001_initial'), ] operations = [ m...
StarcoderdataPython
4803350
import pigpio import time pi = pigpio.pi() h = pi.spi_open(0, 5000000, 0) while True: val = pi.spi_read(h, 2) temp = (int.from_bytes(val[1], 'big', signed = True) >> 2) / 4 print('temp = {0:.1f}'.format(temp)) time.sleep(1)
StarcoderdataPython
1703971
<reponame>haowsun/xgboost_py<filename>compute_fill_acc_by_threshold.py<gh_stars>0 #%% #coding:utf-8 import os import pandas as pd import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['Arial Unicode MS'] #用来正常显示中文标签 plt.rcParams['axes.unicode_minus']=False #用来正常显示负号 # 参数 version = 'v1_0' date = '20210408-2...
StarcoderdataPython
1690484
<gh_stars>100-1000 from exploits.hashes.collisions import python2_32 from test.exploits.dummy_output import DummyOutput from input.chars import CharGenerator import pytest def test_run_small_collision_output(): output = DummyOutput() n_collisions = 2 length = 7 substring_length = 3 target = '42' ...
StarcoderdataPython
34022
from tensorpy import image_base classifications = image_base.classify_folder_images('./images') print("*** Displaying Image Classification Results as a list: ***") for classification in classifications: print(classification)
StarcoderdataPython
3241081
gauss_kernel = numpy.array([[1,2,1], [2,4,1], [1,2,1]]) * 1.0/16 def blur_naive_version(iamge, districts, scale): if(len(image.shape)!=3): print("error") exit(0) new_image = image.copy() for district in districts: new_image = gauss_blur_naive_version(new_image, district, scale) return new_ima...
StarcoderdataPython
3320932
<filename>nemcore/types/get_song_detail_resp.py from typing import List, Any from .easy_access import EasyAccessDict class ChargeInfoList(EasyAccessDict): rate: int charge_url: None charge_message: None charge_type: int class FreeTrialPrivilege(EasyAccessDict): res_consumable: bool user_con...
StarcoderdataPython
3343940
<filename>setup.py # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encod...
StarcoderdataPython
1765795
# -*- coding:utf-8 -*- import datetime from flask import current_app from app.libs.datetime_helper import strptime_to_str # menu class MenuViewModel: def __init__(self,menu): from app.block.permission.model import Menu self.id = menu['id'] self.name=menu['name'] current_rules=[] ...
StarcoderdataPython
3255543
<filename>python_da/dsfs/mycode/ch10.py from numpy.random import binomial import pandas as pd P_LUKE = 0.005 P_LEUKEMIA = 0.014 N = int(1e6) df = pd.DataFrame({"lukes": [binomial(1, P_LUKE) for _ in range(N)], "leukemia": [binomial(1, P_LEUKEMIA) for _ in range(N)]}) pd.crosstab(df["lukes"], df["le...
StarcoderdataPython
3241525
""" Created on Sat Dec 10 12:40:17 2017 @author: <NAME> """ def simHeatpump(T_cold, T_hot=50.0, efficiency=0.45, T_limit=-20.0, COP_limit=7.0): """ Creates a timedepent Coefficient of Performance (COP) based on the potential carnot efficiency and a quality grade/efficiency of the system. Parameters ...
StarcoderdataPython
4802176
<reponame>erialc-cal/NLP-FOMC #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 6 22:48:18 2021 @author: <NAME> One thing you can do (in the meanwhile, before we get more into the LDA) is to see if it is doable to put in an excel or txt file the desired fund rates of FOMC members from the 70s to...
StarcoderdataPython
3364247
<filename>dbaccess/test_spi.py # Read all temp sensors and write their datas into the table. # Note: # Added a multi-threaded function, but the reading of the 1WD seems to # still just be taking ~900ms between samples and so you might hit a # 1 second delay. So it helps, but not much to use a thread. # import sql...
StarcoderdataPython
1635042
<gh_stars>0 #!/usr/bin/env python3 import sys import shutil import threading import queue from pathlib import Path from pprint import pformat from .manifest import Manifest from .dependency import Dependency, sources_conflict_check from .lock import LockFile from .common import WitUserError, error from .witlogger impo...
StarcoderdataPython
1636094
<reponame>STARS4ALL/zptess # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright (c) 2021 # # See the LICENSE file for details # see the AUTHORS file for authors # ---------------------------------------------------------------------- #-------------------- # Syste...
StarcoderdataPython
4831282
# -*- coding: utf-8 -*- import colorama import os from datetime import datetime class Output(object): """ Manages the output, either to the stdout or the file. """ def __init__(self, results: dict, no_colors: bool): self.results = results self.no_colors = no_colors if not no_colors: ...
StarcoderdataPython
3327198
<reponame>rootart/innerpoint from rest_framework import serializers from rest_framework_gis.fields import GeometryField class RandomPointSerializer(serializers.Serializer): name = serializers.CharField() iso_2_digit = serializers.CharField() iso_3_digit = serializers.CharField() point = GeometryField(...
StarcoderdataPython
4815039
<reponame>johntiger1/blog-posts<filename>scripts/utils.py """ Plots Bandit Algorithms performance. """ import matplotlib.pyplot as plt import numpy as np from bandit_algorithms.epsilon_greedy.epsilon_greedy_algorithm import ( EpsilonGreedy, AnnealingEpsilonGreedy ) from bandit_algorithms.softmax.softmax_...
StarcoderdataPython
3324126
<filename>f_TIC_TAC_TOE/c_human_agent.py class Human_Agent: def __init__(self, name, env): self.name = name self.env = env def get_action(self, current_state): available_actions_ids = current_state.get_available_actions() valid_action_id = False action_id = None ...
StarcoderdataPython
61248
<filename>trainingset_tools.py import random import pickle import pymongo ############################################################## def get_gabra_word_groups(): ''' Create a list of words obtained from a loaded Gabra MongoDB database and group them by lemma. Caches result into a pickle to avoid usi...
StarcoderdataPython
19238
from __future__ import absolute_import import six from rest_framework.response import Response from sentry.api.base import DocSection from sentry.api.bases.organization import OrganizationEndpoint from sentry.api.serializers import serialize from sentry.models import Project, Team from sentry.utils.apidocs import sc...
StarcoderdataPython
75262
import json import logging import re import sys from fastapi import FastAPI, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.gzip import GZipMiddleware from fastapi.openapi.utils import get_openapi from fastapi.responses import JSONResponse from timvt.db.catalog import table_index fr...
StarcoderdataPython
1736161
<gh_stars>0 import logging from typing import Iterable, Optional from dvc.exceptions import InvalidArgumentError from dvc.repo import locked from dvc.repo.experiments.base import UnchangedExperimentError logger = logging.getLogger(__name__) def _parse_params(path_params: Iterable): from ruamel.yaml import YAMLE...
StarcoderdataPython
4834322
STAT_STAGE_MULTIPLIERS = { -6: 2 / 8, -5: 2 / 7, -4: 2 / 6, -3: 2 / 5, -2: 2 / 4, -1: 2 / 3, 0: 2 / 2, 1: 3 / 2, 2: 4 / 2, 3: 5 / 2, 4: 6 / 2, 5: 7 / 2, 6: 8 / 2, } MOVE_META_CATEGORIES = [ "Inflicts damage", "No damage; inflicts status ailment", "No dama...
StarcoderdataPython
3351574
<gh_stars>10-100 # -*- coding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns('userprofiles.contrib.accountverification.views', url(r'^(?P<activation_key>\w+)/$', 'registration_activate', name='userprofiles_registration_activate'), )
StarcoderdataPython
4825002
<reponame>imduffy15/python-androidtv<gh_stars>0 """Constants used throughout the code. **Links** * `ADB key event codes <https://developer.android.com/reference/android/view/KeyEvent>`_ * `MediaSession PlaybackState property <https://developer.android.com/reference/android/media/session/PlaybackState.html>`_ """ i...
StarcoderdataPython
3352020
from django.shortcuts import render from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from profile_api import serializers from rest_framework import viewsets from rest_framework import filters from rest_framework.authtoken.views import ObtainAuthToke...
StarcoderdataPython
100537
""" Defines some useful utilities for plotting the evolution of a Resonator Network """ import copy import numpy as np import matplotlib from matplotlib import pyplot as plt from matplotlib.gridspec import GridSpec from matplotlib.lines import Line2D from utils.encoding_decoding import cosine_sim class LiveResonatorP...
StarcoderdataPython
1684937
import torch import matplotlib.pyplot as plt # Calculate total link length for given sample, it is assumed the base of robot is at (0,0). Input is the position of joints in one timestamp def base_to_ee_distance(input): ## Turn data to sets of 2 so that we can reach each joint seperately. different_view = inp...
StarcoderdataPython
75261
<gh_stars>1-10 import os import time from pathlib import Path import torch import numpy as np import torch.backends.cudnn as cudnn from argparse import ArgumentParser # user from builders.model_builder import build_model from builders.dataset_builder import build_dataset_test, build_dataset_predict from utils.utils im...
StarcoderdataPython
3371877
<gh_stars>0 # Class for storing and retrieving core data class CoreData(): # List of races races = [ 'dragonborn', 'dwarf', 'elf', 'gnome', 'half-elf', 'half-orc', 'halfling', 'human', 'tiefling' ] # Dict of subraces...
StarcoderdataPython
55257
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by <NAME> Gravity.com licenses this file t...
StarcoderdataPython
3355745
import operator_benchmark as op_bench import torch import torch.nn as nn """ Microbenchmarks for the hardsigmoid operator. """ # Configs for hardsigmoid ops hardsigmoid_configs_short = op_bench.config_list( attr_names=[ 'N', 'C', 'H', 'W' ], attrs=[ [1, 3, 256, 256], [4, 3, 256,...
StarcoderdataPython
1620705
<gh_stars>10-100 # Author: <NAME> <<EMAIL>> # License: MIT import copy from functools import reduce import math import numpy as np import operator as op import pandas as pd from random import shuffle, seed from wittgenstein.base import Cond, Rule, Ruleset from wittgenstein.check import ( _warn, _warn_only_si...
StarcoderdataPython
3331070
<gh_stars>1-10 #!/usr/bin/env python2 """Program to investigate the transition distribution $p(z_{n+1} \mid z_n)$ for the available map trajectories. Usage: <program name> <trajectory> [<trajectory> [...]]""" from bz2 import BZ2File from collections import defaultdict from sys import argv from matplotlib import pyp...
StarcoderdataPython
1618556
<reponame>carlos357890/My-projects---Python def jogar(): print("_"*30) print("*"*5+"JOGO DA FORCA"+"*"*5) print("_"*30) palavra_secreta = "banana" letras_acertadas = ['_', '_', '_', '_', '_', '_'] enforcou = False acertou = False erros = 0 print(letras_acertadas) while (not e...
StarcoderdataPython
1785512
# coding:utf-8 from functools import wraps def login_required(func): @wraps(func) def wrapper(*args, **kwargs): """装饰器的内层函数""" pass return wrapper @login_required def logout(): """登出""" pass if __name__ == '__main__': print(logout.__name__) # -> wrapper print(logout.__...
StarcoderdataPython
3386374
from .server import AGIServer
StarcoderdataPython
12471
"""Provides the MENU html string which is appended to all templates Please note that the MENU only works in [Fast](https://www.fast.design/) based templates. If you need some sort of custom MENU html string feel free to customize this code. """ from awesome_panel_extensions.frameworks.fast.fast_menu import to_menu f...
StarcoderdataPython
1635635
<reponame>gaetanmargueritte/ccg2esn #!/usr/bin/env python2 # -*- coding: utf-8 -*- from grammar_manipulation import role_for_words, cat, union, maybe, sentence_to_roles from predicate_manipulation import WordPredicate, NO_ROLE, ACTION, OBJECT, COLOR from collections import defaultdict import numpy as np import tqdm ...
StarcoderdataPython
3206826
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
3372595
<gh_stars>0 from collections import defaultdict import os import pickle class DataContainer(object): def __init__(self, name): super().__init__() self.name = name self._data_dict = defaultdict(lambda: []) def __getitem__(self, key): return self._data_dict[key] def __setit...
StarcoderdataPython
9084
<gh_stars>1-10 """Module to initialize Maxmind databases and lookup IP metadata.""" import logging import os from typing import Optional, Tuple, NamedTuple import geoip2.database from pipeline.metadata.mmdb_reader import mmdb_reader MAXMIND_CITY = 'GeoLite2-City.mmdb' MAXMIND_ASN = 'GeoLite2-ASN.mmdb' # Tuple(netb...
StarcoderdataPython
164202
<filename>src/niweb/apps/noclook/forms/nordunet.py<gh_stars>1-10 # -*- coding: utf-8 -*- __author__ = 'lundberg' from django import forms from django.db import IntegrityError from apps.noclook.models import UniqueIdGenerator, NordunetUniqueId, NodeHandle from apps.noclook.helpers import get_provider_id from .. import ...
StarcoderdataPython
3337226
<gh_stars>0 import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( '.molecule/ansible_inventory').get_hosts('all') def test_vault_running_and_enabled(host): vault = host.service("vault") assert vault.is_running assert vault.is_enabled
StarcoderdataPython
4834697
from django.conf.urls.defaults import * rootpatterns = patterns('', (r'^social/account/', include('socialregistration.urls')), )
StarcoderdataPython
179582
<reponame>hgt312/EE334 import tensorflow as tf import numpy as np x_data = np.loadtxt('datax.txt') x_data = np.reshape(x_data, (-1,)) y_data = np.loadtxt('datay.txt') y_data = np.reshape(y_data, (-1,)) W = tf.Variable(tf.random_uniform((1,), -1., 1.)) b = tf.Variable(tf.zeros((1,))) y = W * x_data + b # Minimize the...
StarcoderdataPython
1656838
from django.urls import path from .views import HistoryTemplateView urlpatterns = [ path('', HistoryTemplateView.as_view(), name='history-index'), ]
StarcoderdataPython
1786080
#------------------------------------# # Author: <NAME> # # Update: 7/10/2019 # # E-mail: <EMAIL> # #------------------------------------# """-------------------------------- - Morphological Transformations - Image erosion - Image dilation - Function morphologyEx - six dif...
StarcoderdataPython
127714
<filename>setup.py from pathlib import Path from distutils.core import setup def get_version(): basedir = Path(__file__).parent with open(basedir / 'urlazy.py') as f: version_line = next(line for line in f if line.startswith('__version__')) return eval(version_line....
StarcoderdataPython
3262341
from setuptools import find_packages, setup import os.path HERE = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(HERE, 'README.md'), encoding='utf-8') as handle: long_description = handle.read() setup( name='actiontest', version='0.1', description='Testing Action using Conda and...
StarcoderdataPython
1798423
import pytest from sanic_routing import BaseRouter from sanic_routing.exceptions import NotFound @pytest.fixture def handler(): def handler(**kwargs): return list(kwargs.values())[0] return handler class Router(BaseRouter): def get(self, path, method, extra=None): return self.resolve(p...
StarcoderdataPython
181001
<reponame>mburq/gym-matching import gym import gym_matching import numpy as np import argparse import time from baselines.common.misc_util import boolean_flag from collections import deque def run(env_id, seed, evaluation, nb_epochs, nb_rollout_steps): # assert env_id in ['Matching-v3', 'Matching-v4'] # only wor...
StarcoderdataPython
3240302
<gh_stars>0 # Generated by Django 3.1.2 on 2021-02-17 22:19 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core_marketing', '0017_auto_20210217_2216'), ] operations = [ migrations.RemoveField( model_name='corevendormlmorders', ...
StarcoderdataPython
84783
<reponame>andreatulimiero/netsec-hs18 from django.shortcuts import render, redirect from django.db import connection from django.http import HttpResponse from django.views import View from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import login, authenticate, logout from .forms import *...
StarcoderdataPython
155720
from datetime import datetime, timedelta, timezone def utc_now() -> datetime: return datetime.now(timezone.utc) def datetime_dump(dt: datetime) -> str: return str(dt.timestamp()) def datetime_load(raw: str) -> datetime: return datetime.fromtimestamp(float(raw), timezone.utc) def timedelta_dump(td: t...
StarcoderdataPython
7027
import discord from jshbot import utilities, data, configurations, plugins, logger from jshbot.exceptions import BotException, ConfiguredBotException from jshbot.commands import ( Command, SubCommand, Shortcut, ArgTypes, Attachment, Arg, Opt, MessageTypes, Response) __version__ = '0.1.0' CBException = ConfiguredB...
StarcoderdataPython
138429
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ n1 = self.ll2num(l1) n2 = self.ll2num(l2) ...
StarcoderdataPython
4822974
from node_exec.base_nodes import defNode CONVERSION_IDENTIFIER = 'Convert' @defNode(name='To Int', returnNames=["int"], identifier=CONVERSION_IDENTIFIER) def toInt(value): return int(value) @defNode(name='To String', returnNames=["str"], identifier=CONVERSION_IDENTIFIER) def toString(value): return str(value...
StarcoderdataPython
3353139
from typing import List, Tuple, cast import pytest from galaxyls.services.xml.nodes import XmlElement from galaxyls.tests.unit.utils import TestUtils class TestXmlElementClass: @pytest.mark.parametrize( "source, expected_offsets", [ ("<test", (5, 5)), ("<test>", (5, 5)), ...
StarcoderdataPython
1692784
<gh_stars>0 from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from django import forms import selectable.forms as selectable from .models import Fruit, Farm, ReferencesTest from .lookups import FruitLookup, OwnerLookup from .forms import Refer...
StarcoderdataPython
1604643
<reponame>jchidley/OctopusEnergyMonitor<gh_stars>0 # Modified from # https://gist.github.com/codeinthehole/5f274f46b5798f435e6984397f1abb64 # Requires the requests library (install with 'pip install requests') import requests import pandas as pd from enum import Enum, auto class OctopusEnergy(object): BASE_URL = ...
StarcoderdataPython
1692292
<filename>edh_web_application/foto/routes.py<gh_stars>1-10 import csv import io import json from flask import render_template, request, jsonify, Response, current_app from flask_babel import _ from . import bp_foto from .forms import FotoSearchDe, FotoSearchEn from ..models.Foto import Foto @bp_foto.route('/foto/su...
StarcoderdataPython
4812308
from typing import Optional from fastapi import FastAPI from demo.hello_world import greet from demo.my_logger import getLogger logger = getLogger("my-FastAPI-logger") app = FastAPI() @app.get("/") def root(): logger.info("The FastAPI root endpoint was called.") return {"message": greet()}
StarcoderdataPython
4842924
<reponame>fluidattacks/bugsnag-python import tornado from tornado.web import RequestHandler, HTTPError from tornado.wsgi import WSGIContainer from typing import Dict, Any from urllib.parse import parse_qs from bugsnag.breadcrumbs import BreadcrumbType from bugsnag.utils import is_json_content_type, sanitize_url from bu...
StarcoderdataPython
1766595
import subprocess import os import uuid import hashlib import logging import basedefs import common_utils as utils import output_messages SELINUX_RW_LABEL = "public_content_rw_t" SHA_CKSUM_TAG = "_SHA_CKSUM" _preprocessLine = lambda line : unicode.encode(unicode(line), 'ascii', 'xmlcharrefreplace') def addNfsExport...
StarcoderdataPython
38443
# Copyright 2003, 2007 by <NAME>. <EMAIL> # All rights reserved. This code is part of the Biopython # distribution and governed by its license. # Please see the LICENSE file that should have been included as part # of this package. import math def lcc_mult(seq,wsize): """Local Composition Complexity (LCC) value...
StarcoderdataPython
3238552
<reponame>zmoon92/proplot #!/usr/bin/env python3 """ The standard x-y axes used for most ProPlot figures. """ import matplotlib.dates as mdates import matplotlib.ticker as mticker import numpy as np from .. import constructor from .. import scale as pscale from .. import ticker as pticker from ..config import rc from ...
StarcoderdataPython
153977
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import absolute_import import re import os import codecs from pelican.readers import parse_path_metadata from .exceptions import FileNotFound, FileAlreadyExists, UnknownFileFormat __all__ = ('PelicanContentFile', 'PelicanArticle', 'RstArticle', 'MarkdownArticle...
StarcoderdataPython
3296108
def case_insensitive_sort_1(string_list): def compare(a, b): return cmp(a.lower(), b.lower()) string_list.sort(compare)
StarcoderdataPython
3316142
<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Examples for the NURBS-Python Package Released under MIT License Developed by <NAME> (c) 2018 Surface fitting by global interpolation """ from geomdl import fitting from geomdl.visualization import VisMPL as vis # Data set points = ...
StarcoderdataPython
170381
from distutils.core import setup setup( name = 'python-tee', packages = ['tee'], version = '0.0.5', license='MIT', description = '', author = '<NAME>', url = 'https://github.com/dante-biase/python-tee', download_url = 'https://github.com/dante-biase/python-tee/archive/v0.0.5.tar.gz', classifiers=[ ...
StarcoderdataPython
1635272
from io import BytesIO, SEEK_END import attr from PIL import Image MAX_EDGE_PIXELS = 1024 QUALITY = 80 SUPPORTED_FORMATS = ('JPEG', 'PNG', 'GIF') MAX_SIZE_IN_BYTES_AFTER_PROCESSING = 1024 * 1024 MIN_AREA_TRACKING_PIXEL = 10 @attr.s class ImageProcessingResult: size_in_bytes: int = attr.ib() width: int = att...
StarcoderdataPython
58966
""" Intermediate Factors @author: <NAME> This module computes the interpolated features between the principal vectors -- the one linking source to target following the geodesics on the Grassmannian. We use the equivalent formulation derived in [1] and represent this geodesics for each pair of principal components. E...
StarcoderdataPython
1721171
from ._ClassRegistry import ClassRegistry from ._functions import is_hashable from ._Interval import Interval from ._InvalidStateError import InvalidStateError from ._memoise import Memoiser, MemoiserFactory, MEMO_EXTENSION, MemoFile, InvalidMemoFileError, PicklableDict from ._pool import run_on_all, num_processes from...
StarcoderdataPython
4827647
<filename>paper_uploads/variations.py import posixpath from variations.variation import Variation class PaperVariation(Variation): """ Расширение возможностей вариации: * Хранение имени вариации """ def __init__(self, *args, name: str = "", **kwargs): self.name = name super()._...
StarcoderdataPython
96859
#!/usr/bin/env python3 # # Copyright (c) 2018 Institute for Basic Science # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to u...
StarcoderdataPython
4801360
<reponame>sapcc/nova<filename>nova/console/shellinaboxproxy.py # Copyright (c) 2018 OpenStack Foundation # 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 # # ...
StarcoderdataPython
1661124
from typing import Dict # The rest of the codebase uses rays everywhere. # Only use these units for user facing interfaces. units: Dict[str, int] = { "venidium": 10 ** 12, # 1 venidium (XVM) is 1,000,000,000,000 ray (1 trillion) "ray": 1, "colouredcoin": 10 ** 3, # 1 coloured coin is 1000 colouredcoin ra...
StarcoderdataPython
114739
<filename>setup.py from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) setup( name='anime', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup....
StarcoderdataPython
3353061
<reponame>mbonix/blpd<filename>blpd/blp.py import blpapi as blp import pandas as pd from typing import Union basestring = (str, bytes) SECURITY_DATA = blp.Name('securityData') SECURITY = blp.Name('security') FIELD_DATA = blp.Name('fieldData') FIELD_EXCEPTIONS = blp.Name('fieldExceptions') FIELD_ID = blp.Name('field...
StarcoderdataPython
1684443
from collections import namedtuple import pytest from ludwig.models.ecd import build_inputs from tests.integration_tests.utils import category_feature from tests.integration_tests.utils import generate_data from tests.integration_tests.utils import numerical_feature from tests.integration_tests.utils import run_exper...
StarcoderdataPython
192626
from distutils.core import setup setup( name='CombinedOneClass', version='0.1dev', packages=['oneclass','oneclass.generators'], license='MIT License', long_description=open('README.md').read(), )
StarcoderdataPython
17270
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-06-03 08:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('book', '0009_book_folder'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
3224759
<reponame>ArrowElectronics/Vital-Signs-Monitoring from ctypes import * from common_application_interface_def import * from m2m2_core_def import * class M2M2_DISPLAY_APP_CMD_ENUM_t(c_ubyte): _M2M2_DISPLAY_APP_CMD_LOWEST = 0x40 M2M2_DISPLAY_APP_CMD_SET_DISPLAY_REQ = 0x42 M2M2_DISPLAY_APP_CMD_SET_DISPLAY_R...
StarcoderdataPython
4808783
<filename>examples/images.py #!/usr/bin/env python import visvis as vv app = vv.use() im = vv.imread('lena.png') im = im[:-1,:-1] # make not-power-of-two (to test if video driver is capable) print im.shape t = vv.imshow(im) t.aa = 2 # more anti-aliasing (default=1) t.interpolate = True # interpolate pixels app.Run...
StarcoderdataPython
3345831
<reponame>peterbe/govspy<filename>snippets/range/range.py names = ["Peter", "Anders", "Bengt"] for i, name in enumerate(names): print("{}. {}".format(i + 1, name))
StarcoderdataPython
1603879
from multiprocessing import Process import os import time # git remote set-url origin https://mgrecu35@github.com/mgrecu35/cmbv7.git def info(title): print(title) print('module name:', __name__) print('parent process:', os.getppid()) print('process id:', os.getpid()) def fsh(fname): cmb1=fname...
StarcoderdataPython
3399871
""" Tighten the axis range to match data """ from typing import Dict def tighten_panel_axis_range(params): # type: (Dict) -> Dict """Tighten the axis range to match data Args: params (dict): plotting parameter dictionary Returns: same as input """ for panel_id, p in params['l...
StarcoderdataPython