text stringlengths 0 1.05M | meta dict |
|---|---|
from fabric import colors
from fabric.api import *
from fabric.contrib.project import *
from fabric.contrib.files import sed, exists
import git
env.app = 'Residency'
env.dest = "/var/www/%(app)s" % env
env.use_ssh_config = True
def reload_processes():
sudo("kill -HUP `cat /tmp/%(app)s.pid`" % env)
def sync():... | {
"repo_name": "Kbman99/CodeWarriors",
"path": "fabfile.py",
"copies": "1",
"size": "1887",
"license": "apache-2.0",
"hash": 9198213440673310000,
"line_mean": 26.347826087,
"line_max": 77,
"alpha_frac": 0.6057233704,
"autogenerated": false,
"ratio": 3.1036184210526314,
"config_test": false,
"h... |
from fabric import colors
from fabric.api import task
from fabric.api import env
from fabric.api import run
from fabric.api import cd
from fabric.api import prefix
env.hosts = ['cloudtun.es']
env.user = 'cloudtunes'
env.key_filename = '~/.ssh/id_dsa'
GITHUB = 'git@github.com:jakubroztocil/cloudtunes.git'
ROOT = '~'... | {
"repo_name": "jakubroztocil/cloudtunes",
"path": "cloudtunes-server/fabfile.py",
"copies": "7",
"size": "1808",
"license": "bsd-3-clause",
"hash": 3761955702251559400,
"line_mean": 24.4647887324,
"line_max": 78,
"alpha_frac": 0.6327433628,
"autogenerated": false,
"ratio": 3.2635379061371843,
"... |
from fabric import colors
from fabric import api as fab
from fabric import decorators
from fabric.contrib import files
import os, getpass
fab.env.colors = True
OS_COMMANDS = ('sudo apt-get install aptitude',
'sudo aptitude update',
'sudo aptitude install python-dev',
'sud... | {
"repo_name": "kyokley/Formare",
"path": "fabfile.py",
"copies": "1",
"size": "6014",
"license": "mit",
"hash": -6713838363237322000,
"line_mean": 32.9774011299,
"line_max": 100,
"alpha_frac": 0.6320252744,
"autogenerated": false,
"ratio": 3.6805385556915544,
"config_test": false,
"has_no_key... |
from fabric import main as fabric_main
from fabric import state
from fabric.main import load_tasks_from_module, find_fabfile
from hemp import api
from hemp.internal.hempfile import load_hempfiles
from hemp.internal.utils import print_info
def main(fabfile_locations=None, file_paths=None):
# type: (list, list) ->... | {
"repo_name": "Addvilz/hemp",
"path": "hemp/main.py",
"copies": "1",
"size": "1046",
"license": "apache-2.0",
"hash": 7346192442148919000,
"line_mean": 32.7419354839,
"line_max": 72,
"alpha_frac": 0.7208413002,
"autogenerated": false,
"ratio": 3.557823129251701,
"config_test": false,
"has_no_... |
from fabric import operations
from fabric.contrib import files
from .utils import sudo_user
__all__ = ['patch_all']
_run_command = operations._run_command
put = operations.put
def _patched_run_command(
command,
shell=True,
pty=True,
combine_stderr=True,
sudo=False,
user=None):
if sudo... | {
"repo_name": "vmihailenco/fabdeploy",
"path": "fabdeploy/monkey.py",
"copies": "1",
"size": "1241",
"license": "bsd-3-clause",
"hash": -4923062156007436000,
"line_mean": 24.3265306122,
"line_max": 78,
"alpha_frac": 0.6341659952,
"autogenerated": false,
"ratio": 3.4957746478873237,
"config_test... |
from fabric import operations
from fabric import tasks
from fabric.api import run
from fabric.api import sudo
from fabric import context_managers
class PuppetBootstrap(tasks.Task):
u'''This installs puppet on a bare OS
'''
name = u'puppet-bootstrap'
def __init__(self, flavour=u'debian', *args, **kwargs):
super(... | {
"repo_name": "serverhorror/test-fabric",
"path": "fabfile.py",
"copies": "1",
"size": "2476",
"license": "bsd-2-clause",
"hash": 609031152466134300,
"line_mean": 51.6808510638,
"line_max": 197,
"alpha_frac": 0.7112277868,
"autogenerated": false,
"ratio": 2.90951821386604,
"config_test": false,... |
from fabric import Result
from mock import patch
from patchwork.info import distro_name, distro_family
class info:
class distro_name:
def returns_other_by_default(self, cxn):
# Sentinels don't exist -> yields default
# TODO: refactor with module contents in feature branch, eg te... | {
"repo_name": "fabric/patchwork",
"path": "tests/info.py",
"copies": "1",
"size": "3085",
"license": "bsd-2-clause",
"hash": 740143204453496600,
"line_mean": 41.8472222222,
"line_max": 79,
"alpha_frac": 0.5925445705,
"autogenerated": false,
"ratio": 4.011703511053316,
"config_test": false,
"h... |
from fabric import state
from fabric.api import run, settings
from logger import logger
from perfrunner.remote.kubernetes import RemoteKubernetes
from perfrunner.remote.linux import RemoteLinux
from perfrunner.remote.windows import RemoteWindows
from perfrunner.settings import ClusterSpec
class RemoteHelper:
de... | {
"repo_name": "couchbase/perfrunner",
"path": "perfrunner/helpers/remote.py",
"copies": "1",
"size": "2095",
"license": "apache-2.0",
"hash": 4219990784274182000,
"line_mean": 35.7543859649,
"line_max": 83,
"alpha_frac": 0.6644391408,
"autogenerated": false,
"ratio": 4.173306772908367,
"config_... |
from fabric import state
from fabric.api import run, settings
from logger import logger
from perfrunner.remote.linux import RemoteLinux
from perfrunner.remote.windows import RemoteWindows
from perfrunner.settings import ClusterSpec
class RemoteHelper:
def __new__(cls, cluster_spec: ClusterSpec, verbose: bool = ... | {
"repo_name": "pavel-paulau/perfrunner",
"path": "perfrunner/helpers/remote.py",
"copies": "1",
"size": "1050",
"license": "apache-2.0",
"hash": 4808702653434921000,
"line_mean": 29.8823529412,
"line_max": 77,
"alpha_frac": 0.6523809524,
"autogenerated": false,
"ratio": 4.2,
"config_test": fals... |
from fabric import task
from patchwork.transfers import rsync
import os
import os.path as osp
from pathlib import Path
import json
## START EDIT: Edit these values to your profiles
# name of the bimhaw profile used in the bootstrapping process
PHASE1_PROFILE = "scooter"
# name of the bimhaw profile that is the end ... | {
"repo_name": "ADicksonLab/wepy",
"path": "fabfile.py",
"copies": "1",
"size": "3325",
"license": "mit",
"hash": -7794553792991640000,
"line_mean": 23.6296296296,
"line_max": 96,
"alpha_frac": 0.6054135338,
"autogenerated": false,
"ratio": 3.175740210124164,
"config_test": false,
"has_no_keyw... |
from fabric import task
from django.utils.termcolors import colorize
# 1. Local: chmod 400 ~/.ssh/aws.pem
# 2. Local: ssh-add ~/.ssh/aws.pem OR ~/.ssh/config: Append to Host: IdentityFile ~/.ssh/aws.pem
# 3. Local: Edit hosts, repo_name, pythonpath (if necessary)
# 4. Remote: Copy .env to to {code_dir}/.env:
hosts ... | {
"repo_name": "richardcornish/richardcornish",
"path": "fabfile.py",
"copies": "1",
"size": "2303",
"license": "bsd-3-clause",
"hash": 4201460552093535000,
"line_mean": 28.1518987342,
"line_max": 197,
"alpha_frac": 0.6426400347,
"autogenerated": false,
"ratio": 3.159122085048011,
"config_test":... |
from fabric import task
from patchwork.files import exists
@task
def setup_user(conn, user, public_key_file=None, no_sudo_passwd=False):
from plush.fabric_commands import prepare_user
messages = prepare_user(conn, user, 'webadmin', add_sudo=True, no_sudo_passwd=no_sudo_passwd)
add_authorized_key... | {
"repo_name": "kbarnes3/Plush",
"path": "fabfile.py",
"copies": "1",
"size": "1402",
"license": "mit",
"hash": -3878168919543975400,
"line_mean": 33.9487179487,
"line_max": 97,
"alpha_frac": 0.6291012839,
"autogenerated": false,
"ratio": 3.531486146095718,
"config_test": false,
"has_no_keywor... |
from fabric.operations import local
from fabric.api import env, settings, run
import os.path
CMD_AGENT = "scp -P %(port)s %(local_file)s %(user)s@%(host)s:%(remote_file)s"
CMD_NOAGENT = "scp -P %(port)s -i %(ident)s %(local_file)s %(user)s@%(host)s:%(remote_file)s"
def scp(local_file, remote_file):
args = {
... | {
"repo_name": "toudi/fabric-deployment",
"path": "commands/__init__.py",
"copies": "1",
"size": "2477",
"license": "bsd-2-clause",
"hash": 3018261415233569300,
"line_mean": 28.1411764706,
"line_max": 99,
"alpha_frac": 0.5785224061,
"autogenerated": false,
"ratio": 3.2635046113306982,
"config_te... |
from fabric.operations import local, os
__author__ = 'yarg'
def _env(env, *args):
if os.name == 'posix':
local("/bin/bash -l -c 'source %s/bin/activate && %s'" % (env, ' && '.join(args)))
def db_create(env="venv"):
_env(env,
"python manage.py syncdb")
def db_migration_initial(env="venv",... | {
"repo_name": "caleb/idea-color-themes",
"path": "fabfile.py",
"copies": "2",
"size": "1580",
"license": "mit",
"hash": -4279586475711964000,
"line_mean": 22.2352941176,
"line_max": 90,
"alpha_frac": 0.5582278481,
"autogenerated": false,
"ratio": 3.2916666666666665,
"config_test": false,
"has... |
from fabric.operations import local, run, sudo
from fabric.context_managers import settings
def new_user(username):
with settings(warn_only=True):
sudo("useradd --no-create-home {username}".format(username=username))
def remote_mkdir(path):
sudo("mkdir -p {path}".format(**locals()))
def remot... | {
"repo_name": "adieyal/test",
"path": "fabutils.py",
"copies": "1",
"size": "1046",
"license": "apache-2.0",
"hash": 5930813394897522000,
"line_mean": 25.8205128205,
"line_max": 77,
"alpha_frac": 0.5812619503,
"autogenerated": false,
"ratio": 3.962121212121212,
"config_test": false,
"has_no_k... |
from fabric.operations import prompt
from loader import get_wrapper
from pios import run_local
import difflib, color
def print_diff(str1, str2):
diff = difflib.ndiff(str1.splitlines(1),
str2.splitlines(1))
for line in list(diff):
if line.startswith('+'):
with color.green():
... | {
"repo_name": "creative-workflow/pi-setup",
"path": "lib/pios/recovery.py",
"copies": "1",
"size": "1975",
"license": "mit",
"hash": -3030557936694556000,
"line_mean": 24.9868421053,
"line_max": 131,
"alpha_frac": 0.6465822785,
"autogenerated": false,
"ratio": 3.3417935702199664,
"config_test":... |
from fabric.operations import put, run, local, sudo, get
from fabric.context_managers import cd, prefix, hide, settings
from fabric.api import execute
import os
import datetime
def deploy(jar, classpath):
with cd('/tmp'):
with hide('running', 'stdout'):
run('mkdir -p libs')
put_if_absent(classpat... | {
"repo_name": "rtshadow/lem",
"path": "fabric/fabfile.py",
"copies": "1",
"size": "3344",
"license": "mit",
"hash": 7997235275038041000,
"line_mean": 30.8476190476,
"line_max": 109,
"alpha_frac": 0.6836124402,
"autogenerated": false,
"ratio": 3.4869655891553704,
"config_test": false,
"has_no_... |
from fabric.operations import run, local
from fabric.state import env
from fabric.network import disconnect_all
import inspect, logging, sys, time, os
#### This managerutils is to invoke the commands separately on the remote machine
#### Initialize variables from env settings file
environment_name = 'None'
path_to_a... | {
"repo_name": "sidnan/python-fabric-deployment-automation",
"path": "utils/managerutils.py",
"copies": "1",
"size": "9571",
"license": "apache-2.0",
"hash": 8830289824102992000,
"line_mean": 38.2295081967,
"line_max": 173,
"alpha_frac": 0.6041166022,
"autogenerated": false,
"ratio": 4.20703296703... |
from fabric.state import _AttributeDict
from fabric.api import cd
from utils import upload_config, config_dir, build_properties
from cloudbio.package.deb import _apt_packages
import os
DEFAULTS = dict(
path='/var/puppet',
log_level='info',
modules=config_dir(os.path.join('puppet', 'modules'))
)
puppet = ... | {
"repo_name": "elkingtonmcb/cloudbiolinux",
"path": "cloudbio/config_management/puppet.py",
"copies": "10",
"size": "2026",
"license": "mit",
"hash": 3419131482267452000,
"line_mean": 33.3389830508,
"line_max": 117,
"alpha_frac": 0.6446199408,
"autogenerated": false,
"ratio": 3.529616724738676,
... |
from fabric.state import env
from fabric.api import sudo, settings
def post_install_postgresql():
"""
example default hook for installing postgresql
"""
from django.conf import settings as s
with settings(warn_only=True):
sudo('/etc/init.d/postgresql-8.4 restart')
sudo("""psql templ... | {
"repo_name": "bretth/woven",
"path": "woven/deploy.py",
"copies": "1",
"size": "1120",
"license": "bsd-3-clause",
"hash": -3613413661437055500,
"line_mean": 47.7391304348,
"line_max": 181,
"alpha_frac": 0.6410714286,
"autogenerated": false,
"ratio": 4.072727272727272,
"config_test": false,
"... |
from fabric.tasks import WrappedCallableTask
def unwrap_tasks(module, hide_nontasks=False):
"""
Replace task objects on ``module`` with their wrapped functions instead.
Specifically, look for instances of `~fabric.tasks.WrappedCallableTask` and
replace them with their ``.wrapped`` attribute (the orig... | {
"repo_name": "ploxiln/fabric",
"path": "fabric/docs.py",
"copies": "1",
"size": "2516",
"license": "bsd-2-clause",
"hash": 541044964346296600,
"line_mean": 43.1403508772,
"line_max": 79,
"alpha_frac": 0.6569952305,
"autogenerated": false,
"ratio": 4.2571912013536375,
"config_test": false,
"h... |
from fabric.utils import abort, indent
from fabric import state
import collections
from six import string_types
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
value... | {
"repo_name": "xLegoz/fabric",
"path": "fabric/task_utils.py",
"copies": "1",
"size": "2857",
"license": "bsd-2-clause",
"hash": 2651343139794563000,
"line_mean": 27.8585858586,
"line_max": 77,
"alpha_frac": 0.5796289814,
"autogenerated": false,
"ratio": 4.064011379800854,
"config_test": false,... |
from fabric.utils import abort, indent
from fabric import state
import collections
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
value = mapping[key]
if not re... | {
"repo_name": "rane-hs/fabric-py3",
"path": "fabric/task_utils.py",
"copies": "1",
"size": "2825",
"license": "bsd-2-clause",
"hash": 2295675469635575000,
"line_mean": 27.8265306122,
"line_max": 77,
"alpha_frac": 0.5762831858,
"autogenerated": false,
"ratio": 4.058908045977011,
"config_test": f... |
from fabric.utils import abort, indent
from fabric import state
import six
from six import iteritems, string_types
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
va... | {
"repo_name": "pashinin/fabric",
"path": "fabric/task_utils.py",
"copies": "1",
"size": "2731",
"license": "bsd-2-clause",
"hash": 8980468342657675000,
"line_mean": 27.4479166667,
"line_max": 77,
"alpha_frac": 0.5789088246,
"autogenerated": false,
"ratio": 4.0220913107511045,
"config_test": fal... |
from fabric.utils import abort, indent
from fabric import state
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
value = mapping[key]
if not rest:
return v... | {
"repo_name": "felix-d/fabric",
"path": "fabric/task_utils.py",
"copies": "2",
"size": "2332",
"license": "bsd-2-clause",
"hash": -8355193839958306000,
"line_mean": 27.0963855422,
"line_max": 77,
"alpha_frac": 0.5630360206,
"autogenerated": false,
"ratio": 4.013769363166953,
"config_test": fals... |
from fabric.utils import abort, indent
from fabric import state
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
value = mapping[key]
if not rest:
return ... | {
"repo_name": "talishte/ctigre",
"path": "env/lib/python2.7/site-packages/fabric/task_utils.py",
"copies": "30",
"size": "2787",
"license": "bsd-2-clause",
"hash": 2253514574011673300,
"line_mean": 27.7319587629,
"line_max": 77,
"alpha_frac": 0.5730175816,
"autogenerated": false,
"ratio": 4.05676... |
from fabric.utils import abort, indent
# For attribute tomfoolery
class _Dict(dict):
pass
def _crawl(name, mapping):
"""
``name`` of ``'a.b.c'`` => ``mapping['a']['b']['c']``
"""
key, _, rest = name.partition('.')
value = mapping[key]
if not rest:
return value
return _crawl(r... | {
"repo_name": "fitoria/fabric",
"path": "fabric/task_utils.py",
"copies": "1",
"size": "2309",
"license": "bsd-2-clause",
"hash": -3498812359283996700,
"line_mean": 26.4880952381,
"line_max": 77,
"alpha_frac": 0.5595495886,
"autogenerated": false,
"ratio": 4.008680555555555,
"config_test": fals... |
from fabsetup.fabutils import install_file_legacy, run, suggest_localhost, subtask
from fabsetup.fabutils import task
from fabsetup.fabutils import checkup_git_repo_legacy
@task
@suggest_localhost
def tmux():
'''Customize tmux for solarized colors and other things.
Tweaks for:
* enable 256 colors
*... | {
"repo_name": "theno/fabsetup",
"path": "fabsetup/fabfile/setup/tmux.py",
"copies": "1",
"size": "1303",
"license": "mit",
"hash": -2848443066121495600,
"line_mean": 28.6136363636,
"line_max": 82,
"alpha_frac": 0.6354566385,
"autogenerated": false,
"ratio": 2.772340425531915,
"config_test": fal... |
from fabtools.vagrant import vagrant_settings
from fabric.contrib.project import rsync_project
from fabric import api
from fabpowertasks.commands import BaseCommands
class DeployCommands(BaseCommands):
"""
Standard tasks for deploying your project
"""
def __init__(self):
super(DeployCommands,... | {
"repo_name": "sbreatnach/fabpowertasks",
"path": "fabpowertasks/deploy.py",
"copies": "1",
"size": "1171",
"license": "mit",
"hash": 3687529117656688600,
"line_mean": 36.7741935484,
"line_max": 77,
"alpha_frac": 0.6464560205,
"autogenerated": false,
"ratio": 3.9694915254237286,
"config_test": ... |
from fac.commands import Command, Arg
from fac.errors import ModNotFoundError
from fac.utils import parse_game_version
class ShowCommand(Command):
"""Show details about specific mods."""
name = 'show'
arguments = [
Arg('mods', help="mods to show", nargs='+'),
Arg('-F', '--format',
... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/show.py",
"copies": "1",
"size": "3196",
"license": "mit",
"hash": -3361646061354751500,
"line_mean": 31.612244898,
"line_max": 75,
"alpha_frac": 0.5093867334,
"autogenerated": false,
"ratio": 4.354223433242507,
"config_test": false,
"has_no... |
from fac.commands import Command, Arg
from fac.errors import ModNotFoundError
from fac.utils import parse_requirement, start_iter, Requirement, Version
class InstallCommand(Command):
"""
Install (or update) mods.
This will install mods matching the given requirements using this format:
name
... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/install.py",
"copies": "1",
"size": "5333",
"license": "mit",
"hash": 1483438424930536700,
"line_mean": 31.1265060241,
"line_max": 79,
"alpha_frac": 0.4873429589,
"autogenerated": false,
"ratio": 4.778673835125448,
"config_test": false,
"has... |
from fac.commands import Command, Arg
from fac.errors import ModNotFoundError
class EnableDisableCommand(Command):
arguments = [
Arg('mods', nargs='+', help="mods patterns to affect"),
]
def run(self, args):
enabled = self.name == 'enable'
for mod_pattern in args.mods:
... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/enable.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": -3465827174859886000,
"line_mean": 25.4761904762,
"line_max": 71,
"alpha_frac": 0.5467625899,
"autogenerated": false,
"ratio": 4.244274809160306,
"config_test": false,
"has... |
from fac.commands import Command, Arg
from fac.utils import prompt
class RemoveCommand(Command):
"""Remove mods."""
name = 'remove'
arguments = [
Arg('mods', help="mod patterns to remove ('*' for all)", nargs='+'),
Arg('-y', '--yes', action='store_true',
help="automatic yes t... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/remove.py",
"copies": "1",
"size": "1307",
"license": "mit",
"hash": 7928607359475891000,
"line_mean": 30.8780487805,
"line_max": 76,
"alpha_frac": 0.519510329,
"autogenerated": false,
"ratio": 4.385906040268456,
"config_test": false,
"has_n... |
from fac.commands import Command, Arg
from fac.utils import prompt, Version
class UpdateCommand(Command):
"""Update installed mods."""
name = 'update'
arguments = [
Arg('-s', '--show', action='store_true',
help="only show what would be updated"),
Arg('-y', '--yes', action='st... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/update.py",
"copies": "1",
"size": "2639",
"license": "mit",
"hash": -2048344670330544000,
"line_mean": 28.9886363636,
"line_max": 72,
"alpha_frac": 0.4607805987,
"autogenerated": false,
"ratio": 4.679078014184397,
"config_test": false,
"has... |
from fac.commands import Command, Arg
class HoldCommand(Command):
"""Hold mods (show held mods with no argument)."""
name = 'hold'
arguments = [
Arg('mods', help="mods patterns to hold", nargs='*'),
]
def run(self, args):
for mod_pattern in args.mods:
mod_pattern = se... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/hold.py",
"copies": "1",
"size": "2066",
"license": "mit",
"hash": 2557847214849074700,
"line_mean": 30.7846153846,
"line_max": 76,
"alpha_frac": 0.486447241,
"autogenerated": false,
"ratio": 4.481561822125814,
"config_test": false,
"has_no_... |
from fac.commands import Command, Arg
class ListCommand(Command):
"""List installed mods and their status."""
_all_tags = ['disabled', 'unpacked', 'held', 'incompatible']
name = 'list'
arguments = [
Arg('-E', '--exclude', metavar='TAG', nargs='+', action='append',
default=[], ch... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/list.py",
"copies": "1",
"size": "3158",
"license": "mit",
"hash": -7022508453397427000,
"line_mean": 32.5957446809,
"line_max": 75,
"alpha_frac": 0.5300823306,
"autogenerated": false,
"ratio": 4.416783216783217,
"config_test": false,
"has_n... |
from fac.commands import Command, Arg
class MakeCompatibleCommand(Command):
"""
Change the supported factorio version of mods.
This modifies the `factorio_version` field in the mods' info.json file
to make them compatible with the current game version.
Packed mods will be unpacked first.
Unp... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/make_compatible.py",
"copies": "1",
"size": "1198",
"license": "mit",
"hash": -1350585950066045000,
"line_mean": 29.7179487179,
"line_max": 74,
"alpha_frac": 0.5667779633,
"autogenerated": false,
"ratio": 4.2785714285714285,
"config_test": fal... |
from fac.commands import Command, Arg
class PackUnpackCommand(Command):
arguments = [
Arg('mods', nargs='+', help="mods patterns to affect"),
Arg('-R', '--replace', action='store_true',
help="replace existing file/directory when packing/unpacking"),
Arg('-K', '--keep', action='... | {
"repo_name": "mickael9/fac",
"path": "fac/commands/pack.py",
"copies": "1",
"size": "1627",
"license": "mit",
"hash": -3197478893483931000,
"line_mean": 30.2884615385,
"line_max": 75,
"alpha_frac": 0.5027658267,
"autogenerated": false,
"ratio": 4.409214092140921,
"config_test": false,
"has_n... |
from FaceAlignment import FaceAlignment
import numpy as np
import cv2
import utils
#Change this to True if you want to use the DAN-Menpo-tracking.npz model, which is able to detect when face tracking is lost.
useTrackingModel = False
if useTrackingModel:
model = FaceAlignment(112, 112, 1, 1, True)
model.loadN... | {
"repo_name": "MarekKowalski/DeepAlignmentNetwork",
"path": "DeepAlignmentNetwork/CameraDemo.py",
"copies": "1",
"size": "2447",
"license": "mit",
"hash": 9124001199712645000,
"line_mean": 33,
"line_max": 125,
"alpha_frac": 0.5962402942,
"autogenerated": false,
"ratio": 3.2757697456492636,
"con... |
from FaceAlignment import FaceAlignment
import numpy as np
import cv2
import utils
model = FaceAlignment(112, 112, 1, 1, True)
model.loadNetwork("../data/DAN-Menpo-tracking.npz")
cascade = cv2.CascadeClassifier("../data/haarcascade_frontalface_alt.xml")
color_img = cv2.imread("../data/jk.jpg")
if len(color_img.shape... | {
"repo_name": "MarekKowalski/DeepAlignmentNetwork",
"path": "DeepAlignmentNetwork/ImageDemo.py",
"copies": "1",
"size": "1322",
"license": "mit",
"hash": -6274753455034384000,
"line_mean": 27.7391304348,
"line_max": 93,
"alpha_frac": 0.6588502269,
"autogenerated": false,
"ratio": 2.70901639344262... |
from FaceAlignment import FaceAlignment
import utils
import numpy as np
import os
import glob
import cv2
import ntpath
from matplotlib import pyplot as plt
ptsOutputDir = "../results/pts/"
imgOutputDir = "../results/imgs/"
MenpoDir = "../data/images/Menpo testset/semifrontal/"
imageHeightFraction = 0.46
networkFilena... | {
"repo_name": "MarekKowalski/DeepAlignmentNetwork",
"path": "DeepAlignmentNetwork/MenpoEval.py",
"copies": "1",
"size": "2127",
"license": "mit",
"hash": 1603000686099315500,
"line_mean": 33.3064516129,
"line_max": 120,
"alpha_frac": 0.6915843912,
"autogenerated": false,
"ratio": 3.08260869565217... |
from face_analyzer import EmbeddingsExtractor
import numpy as np
import os
from scipy.spatial import distance
class CentroidFilter:
def __init__(self):
self.embeddings_extractor = EmbeddingsExtractor()
def filter(self, person_files, threshold):
data_list = []
for person_file in person... | {
"repo_name": "hudvin/brighteye",
"path": "facenet_experiments/utils/dataset/centroid_filter.py",
"copies": "1",
"size": "1946",
"license": "apache-2.0",
"hash": 115944808700284400,
"line_mean": 41.3043478261,
"line_max": 121,
"alpha_frac": 0.6099691675,
"autogenerated": false,
"ratio": 4.1759656... |
from facebookads.api import FacebookAdsApi
from facebookads import objects
import argparse
import sys, os, datetime, traceback
import fb_config, fb_notification, fb_store
"""
KEY for the persistent storage.
"""
KEY_LASTSPENT = 'fb_ads_lastspent'
class FBMonitor:
def __init__(self, configfile=None):
self.config ... | {
"repo_name": "wangqi/facebookads",
"path": "python/fb_monitor_cost.py",
"copies": "1",
"size": "4016",
"license": "apache-2.0",
"hash": 6562295078527845000,
"line_mean": 40.8333333333,
"line_max": 161,
"alpha_frac": 0.6962151394,
"autogenerated": false,
"ratio": 3.0963762528912877,
"config_tes... |
from facebook_business.adobjects.adaccount import AdAccount as fbAdAccount
from facebook_business.adobjects.campaign import Campaign as fbAdCampaign
from facebook_business.adobjects.adset import AdSet as fbAdSet
from facebook_business.adobjects.ad import Ad as fbAd
from facebook_business.adobjects.adsinsights import Ad... | {
"repo_name": "codesmart-co/bit",
"path": "connectors/fb_ads/sync_fields.py",
"copies": "1",
"size": "7236",
"license": "apache-2.0",
"hash": -977341733414532900,
"line_mean": 33.1320754717,
"line_max": 80,
"alpha_frac": 0.737700387,
"autogenerated": false,
"ratio": 2.809006211180124,
"config_t... |
from facebook import get_user_from_cookie, GraphAPI
from flask import g, flash, render_template, redirect, request, session, url_for
from app import app, db
from config import FB_APP_ID, FB_APP_NAME, FB_APP_SECRET
from .models import User
@app.route('/')
def index():
if g.user:
return render_template('i... | {
"repo_name": "erllypaguntalan/pythreads",
"path": "app/views.py",
"copies": "1",
"size": "2299",
"license": "bsd-3-clause",
"hash": 8000712397307987000,
"line_mean": 30.0810810811,
"line_max": 90,
"alpha_frac": 0.5745976512,
"autogenerated": false,
"ratio": 3.6376582278481013,
"config_test": f... |
from facebook import get_user_from_cookie, GraphAPI
from flask import g, render_template, redirect, request, session, url_for
from app import app, db
from models import User
# Facebook app details
FB_APP_ID = ''
FB_APP_NAME = ''
FB_APP_SECRET = ''
@app.route('/')
def index():
# If a user was set in the get_curr... | {
"repo_name": "czl/hackTX_2014",
"path": "facebook-sdk-master/examples/flask/app/views.py",
"copies": "1",
"size": "3067",
"license": "mit",
"hash": -2478340151082686500,
"line_mean": 35.5119047619,
"line_max": 79,
"alpha_frac": 0.6318878383,
"autogenerated": false,
"ratio": 3.9472329472329473,
... |
from facebook import get_user_from_cookie, GraphAPI
from flask import g, render_template, redirect, request, session, url_for
from app import app, db
from .models import User
# Facebook app details
FB_APP_ID = ""
FB_APP_NAME = ""
FB_APP_SECRET = ""
@app.route("/")
def index():
# If a user was set in the get_cur... | {
"repo_name": "Aloomaio/facebook-sdk",
"path": "examples/flask/app/views.py",
"copies": "2",
"size": "3173",
"license": "apache-2.0",
"hash": 7467896970185643000,
"line_mean": 32.4,
"line_max": 79,
"alpha_frac": 0.6199180586,
"autogenerated": false,
"ratio": 3.936724565756824,
"config_test": fa... |
from facebook import *
from database import *
import dateutil.parser
import sys
class Collector:
class statistics:
messages_collected = 0
threads_updated = 0
threads_skipped = 0
def __init__ (self, access_token):
self.facebook = Facebook(access_token)
self.database = Database()
def collect (self):
... | {
"repo_name": "fredefl/facebook-message-backup",
"path": "collector/collector.py",
"copies": "1",
"size": "3064",
"license": "mit",
"hash": -5142639585995228000,
"line_mean": 30.2755102041,
"line_max": 119,
"alpha_frac": 0.6902741514,
"autogenerated": false,
"ratio": 3.385635359116022,
"config_... |
from facebook_model import FacebookPageData, FacebookModel, db
import facebook_module as facebook
def mine_fb_page_data(username=None):
# if only for one user
if username:
fb_user = FacebookModel.query.filter_by(username=username).order_by('-id').first()
users = [fb_user]
fb_user.active = True
... | {
"repo_name": "wigginslab/lean-workbench",
"path": "lean_workbench/facebook/fb_mine.py",
"copies": "1",
"size": "1256",
"license": "mit",
"hash": -4026726289440053000,
"line_mean": 29.6341463415,
"line_max": 88,
"alpha_frac": 0.6417197452,
"autogenerated": false,
"ratio": 3.179746835443038,
"co... |
from FacebookWebBot import *
import os, json, random, jsonpickle
from Spam import spam
from loginInfo import Info
posts_=[]
selfProfile = "https://mbasic.facebook.com/profile.php?fref=pb"
grups = ["https://mbasic.facebook.com/groups/830198010427436",
"https://m.facebook.com/groups/1660869834170435",... | {
"repo_name": "hikaruAi/FacebookBot",
"path": "BotAI.py",
"copies": "1",
"size": "11235",
"license": "apache-2.0",
"hash": -2571782306911809000,
"line_mean": 65.2634730539,
"line_max": 785,
"alpha_frac": 0.7434345233,
"autogenerated": false,
"ratio": 3.797498309668695,
"config_test": false,
"... |
from faceclient.client import FaceClient
class Demo(object):
def __init__(self):
self.client = FaceClient()
def create_images(self, group_name):
faces = self.client.detection.detect()
for name, face in faces.iteritems():
self.client.person.create(person_name=name,
... | {
"repo_name": "kwailamchan/programming-languages",
"path": "python/facepp/facepp/apps/demo.py",
"copies": "3",
"size": "1168",
"license": "mit",
"hash": -5730318198181783000,
"line_mean": 33.3529411765,
"line_max": 73,
"alpha_frac": 0.6344178082,
"autogenerated": false,
"ratio": 3.829508196721311... |
from facefit import cascade
from facefit.pixel_extractor import PixelExtractorBuilder
from fern import FernBuilder
from fern_cascade import FernCascadeBuilder
class ESRBuilder(cascade.CascadedShapeRegressorBuilder):
def __init__(self, n_landmarks=68, n_stages=10, n_perturbations=20, n_ferns=500, n_pixels=400, ka... | {
"repo_name": "AndrejMaris/facefit",
"path": "facefit/esr/builder.py",
"copies": "1",
"size": "1174",
"license": "mit",
"hash": -2977629075741437000,
"line_mean": 60.8421052632,
"line_max": 114,
"alpha_frac": 0.6473594549,
"autogenerated": false,
"ratio": 3.77491961414791,
"config_test": false,... |
from facefit import cascade
from facefit.pixel_extractor import PixelExtractorBuilder
from tree import RegressionTreeBuilder
from forest import RegressionForestBuilder
class ERTBuilder(cascade.CascadedShapeRegressorBuilder):
def __init__(self, n_landmarks=68, n_stages=10, n_trees=500, tree_depth=5, n_candidate_spl... | {
"repo_name": "AndrejMaris/facefit",
"path": "facefit/ert/builder.py",
"copies": "1",
"size": "1096",
"license": "mit",
"hash": -4835551128011881000,
"line_mean": 56.6842105263,
"line_max": 114,
"alpha_frac": 0.6660583942,
"autogenerated": false,
"ratio": 3.9424460431654675,
"config_test": fals... |
from facefit.lbf.feature_extractor import LocalBinaryFeaturesExtractorBuilder
from facefit.lbf.linear_regression import GlobalRegressionBuilder
import numpy as np
from facefit import cascade
class LBFBuilder(cascade.CascadedShapeRegressorBuilder):
# More accurate (but slower version): n_stages = 5, n_trees = 1200... | {
"repo_name": "AndrejMaris/facefit",
"path": "facefit/lbf/builder.py",
"copies": "1",
"size": "1461",
"license": "mit",
"hash": 1491799925860282600,
"line_mean": 59.875,
"line_max": 110,
"alpha_frac": 0.537303217,
"autogenerated": false,
"ratio": 4.174285714285714,
"config_test": false,
"has_... |
from face import Face
from hyperedge import HyperEdge
import numpy as np
def inflate(face, thickness=.1, edges=False):
dt = np.array([[0],[0],[thickness/2.],[0]])
nf = face-dt
pf = face+dt
faces = []
if edges:
faces.append(np.transpose(np.array((pf[:,0], nf[:,0], pf[:,1]))))
faces.append(np.transpo... | {
"repo_name": "PRECISE/ROSLab",
"path": "resources/mechanics_lib/api/graphs/graph.py",
"copies": "1",
"size": "8895",
"license": "apache-2.0",
"hash": 2737328146486043000,
"line_mean": 26.796875,
"line_max": 151,
"alpha_frac": 0.5939291737,
"autogenerated": false,
"ratio": 2.9049640757674724,
"... |
from face import Face
from math import sin, cos, pi
class RegularNGon(Face):
def __init__(self, name, n, length, edgeNames=None, allEdges=None):
pts = []
lastpt = (0, 0)
dt = (2 * pi / n)
for i in range(n):
lastpt = (lastpt[0] + cos(i * dt), lastpt[1] + sin(i * dt))
pts.append(lastpt)
... | {
"repo_name": "PRECISE/ROSLab",
"path": "resources/mechanics_lib/api/graphs/shapes.py",
"copies": "1",
"size": "1707",
"license": "apache-2.0",
"hash": 3719790733653167600,
"line_mean": 34.5625,
"line_max": 102,
"alpha_frac": 0.5934387815,
"autogenerated": false,
"ratio": 2.753225806451613,
"co... |
from facepy import GraphAPI
from django.conf import settings
import os
# Initialize the Graph API with a valid access token (optional,
# but will allow you to do all sorts of fun stuff).
# oauth_access_token = 'EAABZC0OOt2wQBAOcKcpbbYiuFyEONLyqOsdUrODvEBLXq6ZCPXBcI1oZA4UZCPrIkXcZBOzkF9ue0AXNRAEjeE4tfJHy4GwjGfT4CZArvk... | {
"repo_name": "Temzasse/ntu-crysis",
"path": "server/crysis/cms/facebookUpdate/facebook.py",
"copies": "1",
"size": "1198",
"license": "mit",
"hash": -7475239108665978000,
"line_mean": 26.2272727273,
"line_max": 211,
"alpha_frac": 0.7328881469,
"autogenerated": false,
"ratio": 2.312741312741313,
... |
from facepy import GraphAPI
from pymongo import MongoClient
import datetime
import time
import sys
from .Entity import FacebookPost
class Facebook:
db = None
facebook_entities = []
analyzer = None
company = None
graphic_api_access = False
def __init__(self, access_code, analyzer):
se... | {
"repo_name": "jclaros/pytextminer-mod5",
"path": "project/fb/Facebook.py",
"copies": "1",
"size": "4250",
"license": "mit",
"hash": 3021973502577120000,
"line_mean": 37.2882882883,
"line_max": 115,
"alpha_frac": 0.58,
"autogenerated": false,
"ratio": 3.946146703806871,
"config_test": false,
... |
from facepy import GraphAPI
import json
"""
Uses facebook graph api.
Use the console at:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=540171036091887%2Ffeed%3Ffields%3Dfrom%2Cmessage%2Ccaption%2Clikes%2Ccomments%7Bfrom%2Cmessage%2Ccreated_time%2Clike_count%2Ccomment_count%7D%2Ccreate... | {
"repo_name": "napsternxg/SentimentSocialNets",
"path": "data.py",
"copies": "1",
"size": "1454",
"license": "apache-2.0",
"hash": 7596929814281340000,
"line_mean": 32.8139534884,
"line_max": 274,
"alpha_frac": 0.681568088,
"autogenerated": false,
"ratio": 2.9917695473251027,
"config_test": fal... |
from facepy import GraphAPI
from .descriptors import Integer, String, Date, Boolean, Entity
class Entity(object):
"""Entities are the base class for anything on Facebook."""
oauth_token = None
"""A string describing an OAuth token."""
_cache = None
"""Graph API cache for this object."""
fac... | {
"repo_name": "vyyvyyv/facebook",
"path": "facebook/entity.py",
"copies": "2",
"size": "1122",
"license": "mit",
"hash": 5282433038802467000,
"line_mean": 26.3658536585,
"line_max": 81,
"alpha_frac": 0.6033868093,
"autogenerated": false,
"ratio": 4.202247191011236,
"config_test": false,
"has_... |
from facepy import GraphAPI
#Your acces token goes here
personal_access_token = ""
#Creating an GraphAPI instance
graph = GraphAPI(personal_access_token)
#Page ID/Name to check for new posts
pageToCheck = ''
#Comment text to post
commentToPost = 'This comment was posted using stalkpy'
#Function that gets the lates... | {
"repo_name": "emanuelcepoi/facebook-activity-checker",
"path": "main.py",
"copies": "1",
"size": "1336",
"license": "mit",
"hash": -3573643038218967000,
"line_mean": 26.2653061224,
"line_max": 94,
"alpha_frac": 0.6856287425,
"autogenerated": false,
"ratio": 3.5157894736842104,
"config_test": f... |
from facepy import GraphAPI
from models import FBUser, Post, Page, Group
class Graph:
def __init__(self, token):
self.graph = GraphAPI(token)
self.me = None
self.friends = []
def fetch_information(self):
"""
Return the data of the user and his friends
... | {
"repo_name": "Diego999/Social-Recommendation-System",
"path": "FBGraph/Graph.py",
"copies": "1",
"size": "4504",
"license": "mit",
"hash": 2567597944394118000,
"line_mean": 40.5094339623,
"line_max": 193,
"alpha_frac": 0.573268206,
"autogenerated": false,
"ratio": 3.409538228614686,
"config_te... |
from facerec.base import cv2, os, np, warnings, collections, LAUNCH_PATH, CASCADE_PATH
class FaceRecognizer():
def __init__(self):
"""
Create a Face Recognizer Class using Fisher Face Recognizer. Uses
OpenCV's FaceRecognizer class. Currently supports Fisher Faces.
"""
self... | {
"repo_name": "jayrambhia/facerec",
"path": "facerec/FaceRecognizer.py",
"copies": "1",
"size": "14183",
"license": "bsd-3-clause",
"hash": 9175484555146415000,
"line_mean": 31.3812785388,
"line_max": 155,
"alpha_frac": 0.5560882747,
"autogenerated": false,
"ratio": 3.8384303112313938,
"config_... |
from facerec.classifier import SVM
from facerec.validation import KFoldCrossValidation
from facerec.model import PredictableModel
from svmutil import *
from itertools import product
import numpy as np
import logging
def range_f(begin, end, step):
seq = []
while True:
if step == 0: break
if ste... | {
"repo_name": "supby/faceidapi",
"path": "faceidapi/facerec/svm.py",
"copies": "4",
"size": "2692",
"license": "mit",
"hash": 5241015037680086000,
"line_mean": 35.8767123288,
"line_max": 171,
"alpha_frac": 0.6515601783,
"autogenerated": false,
"ratio": 3.9127906976744184,
"config_test": false,
... |
from facerec.distance import EuclideanDistance
from facerec.util import asRowMatrix
import logging
import numpy as np
import operator as op
class AbstractClassifier(object):
def compute(self,X,y):
raise NotImplementedError("Every AbstractClassifier must implement the compute method.")
def predict... | {
"repo_name": "rishabhjain141/FaceRecCode",
"path": "classifier.py",
"copies": "3",
"size": "7254",
"license": "bsd-3-clause",
"hash": -1494923980510292500,
"line_mean": 38.6393442623,
"line_max": 250,
"alpha_frac": 0.5988420182,
"autogenerated": false,
"ratio": 4.140410958904109,
"config_test"... |
from facerec.feature import AbstractFeature
import numpy as np
class FeatureOperator(AbstractFeature):
"""
A FeatureOperator operates on two feature models.
Args:
model1 [AbstractFeature]
model2 [AbstractFeature]
"""
def __init__(self,model1,model2):
if (not isinstance(... | {
"repo_name": "rishabhjain141/FaceRecCode",
"path": "operators.py",
"copies": "3",
"size": "3681",
"license": "bsd-3-clause",
"hash": -6694647286347674000,
"line_mean": 31.2894736842,
"line_max": 121,
"alpha_frac": 0.5756587884,
"autogenerated": false,
"ratio": 3.6663346613545817,
"config_test"... |
from facerec.feature import Fisherfaces
from facerec.classifier import NearestNeighbor
from facerec.model import PredictableModel
from PIL import Image
import numpy as np
from PIL import Image
import sys, os
#sys.path.append("../..")
import cv2
import multiprocessing
model = PredictableModel(Fisherfaces(), NearestNe... | {
"repo_name": "ArianeFire/HaniCam",
"path": "Hanicam/FACE_KNOWN/progV2/scriptVideoCVV2.py",
"copies": "1",
"size": "3522",
"license": "mit",
"hash": -4930526484670033000,
"line_mean": 32.2264150943,
"line_max": 100,
"alpha_frac": 0.6081771721,
"autogenerated": false,
"ratio": 3.231192660550459,
... |
from facerec.normalization import minmax
import os as os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
# try to import the PIL Image module
try:
from PIL import Image
except ImportError:
import Image
import math as math
def create_font(fontname='Tahoma', fontsize=10):
retu... | {
"repo_name": "supby/faceidapi",
"path": "faceidapi/facerec/visual.py",
"copies": "3",
"size": "3022",
"license": "mit",
"hash": -1739216588936256000,
"line_mean": 34.9761904762,
"line_max": 145,
"alpha_frac": 0.6091992058,
"autogenerated": false,
"ratio": 3.2991266375545854,
"config_test": fal... |
from facerecognition import *
from time import sleep
import logging
from datetime import datetime, timedelta
import audio
import nodered
class Intercom(object):
"""An intercom for the things."""
def __init__(self):
self.bell_button_gpio = 4
self.bell_speaker_gpio = 2
self.display_i2c ... | {
"repo_name": "git-commit/iot-gatekeeper",
"path": "gatekeeper/intercom.py",
"copies": "1",
"size": "1522",
"license": "mit",
"hash": -8166176468466121000,
"line_mean": 28.8431372549,
"line_max": 70,
"alpha_frac": 0.653088042,
"autogenerated": false,
"ratio": 3.515011547344111,
"config_test": f... |
from facerec_py.facerec.classifier import SVM
from facerec_py.facerec.validation import KFoldCrossValidation
from facerec_py.facerec.model import PredictableModel
from svmutil import *
from itertools import product
import numpy as np
import logging
def range_f(begin, end, step):
seq = []
while True:
i... | {
"repo_name": "idf/FaceReader",
"path": "facerec_py/facerec/svm.py",
"copies": "1",
"size": "2727",
"license": "mit",
"hash": 412007432548361900,
"line_mean": 35.36,
"line_max": 171,
"alpha_frac": 0.6530986432,
"autogenerated": false,
"ratio": 3.879089615931721,
"config_test": false,
"has_no_... |
from facerec_py.facerec.distance import EuclideanDistance
from facerec_py.facerec.normalization import gaussian_kernel, inverse_dissim
from facerec_py.facerec.util import asRowMatrix
import logging
import numpy as np
import operator as op
class AbstractClassifier(object):
def compute(self, X, y):
raise No... | {
"repo_name": "idf/FaceReader",
"path": "facerec_py/facerec/classifier.py",
"copies": "1",
"size": "7807",
"license": "mit",
"hash": -273270505518463230,
"line_mean": 37.0829268293,
"line_max": 116,
"alpha_frac": 0.6033047265,
"autogenerated": false,
"ratio": 4.148246546227417,
"config_test": f... |
from facerec_py.facerec.feature import AbstractFeature
import numpy as np
from facerec_py.facerec.util import asColumnMatrix
from sklearn.decomposition import KernelPCA
__author__ = 'Danyang'
class KPCA(AbstractFeature):
def __init__(self, num_components=50, kernel="poly", degree=3, coef0=0.0, gamma=None):
... | {
"repo_name": "idf/FaceReader",
"path": "expr/kernelpca_ski.py",
"copies": "1",
"size": "2832",
"license": "mit",
"hash": 8432817654098860000,
"line_mean": 33.1325301205,
"line_max": 127,
"alpha_frac": 0.6038135593,
"autogenerated": false,
"ratio": 4.201780415430267,
"config_test": false,
"ha... |
from facerec_py.facerec.feature import AbstractFeature
import numpy as np
class FeatureOperator(AbstractFeature):
"""
A FeatureOperator operates on two feature models.
Args:
model1 [AbstractFeature]
model2 [AbstractFeature]
"""
def __init__(self, model1, model2):
if (... | {
"repo_name": "idf/FaceReader",
"path": "facerec_py/facerec/operators.py",
"copies": "1",
"size": "3682",
"license": "mit",
"hash": 3118856631180888000,
"line_mean": 28.9349593496,
"line_max": 103,
"alpha_frac": 0.5779467681,
"autogenerated": false,
"ratio": 3.631163708086785,
"config_test": fa... |
from facerec_py.facerec.normalization import minmax
import os as os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
# try to import the PIL Image module
try:
from PIL import Image
except ImportError:
import Image
import math as math
def create_font(fontname='Tahoma', fontsize=10... | {
"repo_name": "idf/FaceReader",
"path": "facerec_py/facerec/visual.py",
"copies": "1",
"size": "3020",
"license": "mit",
"hash": -8563893556601220000,
"line_mean": 33.7126436782,
"line_max": 145,
"alpha_frac": 0.6125827815,
"autogenerated": false,
"ratio": 3.2790445168295332,
"config_test": fal... |
from facette.connection import *
from facette.utils import *
from facette.v1.graph import Graph
from facette.v1.plots import Plots
import json
class Graphs:
def __init__(self, c):
self.root = "/api/v1/library/graphs/"
self.c = c
self.plots = Plots(self.c)
def list(self, collection=None... | {
"repo_name": "OpenTouch/python-facette",
"path": "src/facette/v1/graphs.py",
"copies": "1",
"size": "1421",
"license": "apache-2.0",
"hash": 3232926310604841000,
"line_mean": 29.2340425532,
"line_max": 74,
"alpha_frac": 0.5665024631,
"autogenerated": false,
"ratio": 3.4658536585365853,
"config... |
from facette.utils import *
from facette.v1.graphgroupserie import GraphGroupSerie
import json
GRAPH_GROUP_NAME = "name"
GRAPH_GROUP_TYPE = "type"
GRAPH_GROUP_STACK_ID = "stack_id"
GRAPH_GROUP_SERIES = "series"
GRAPH_GROUP_SCALE = "scale"
class GraphGroup:
def __init__(self, js=""):
self.grou... | {
"repo_name": "OpenTouch/python-facette",
"path": "src/facette/v1/graphgroup.py",
"copies": "1",
"size": "1634",
"license": "apache-2.0",
"hash": 8246447097058181000,
"line_mean": 35.3111111111,
"line_max": 80,
"alpha_frac": 0.5844553244,
"autogenerated": false,
"ratio": 3.222879684418146,
"con... |
from facette.utils import *
import json
GRAPH_GROUP_SERIE_NAME = "name"
GRAPH_GROUP_SERIE_ORIGIN = "origin"
GRAPH_GROUP_SERIE_SOURCE = "source"
GRAPH_GROUP_SERIE_METRIC = "metric"
GRAPH_GROUP_SERIE_SCALE = "scale"
class GraphGroupSerie:
def __init__(self, js=""):
self.serie = {}
self.name = f... | {
"repo_name": "OpenTouch/python-facette",
"path": "src/facette/v1/graphgroupserie.py",
"copies": "1",
"size": "1291",
"license": "apache-2.0",
"hash": 6238720289159558000,
"line_mean": 42.0333333333,
"line_max": 80,
"alpha_frac": 0.6646010844,
"autogenerated": false,
"ratio": 2.901123595505618,
... |
from fackup.cmd import BackupCommand
class Rsync(BackupCommand):
def __init__(self, server, dry_run=False):
super(Rsync, self).__init__(server)
self.dry_run = dry_run
self.binary = self._get_cfg('bin')
self.params = self._get_cfg('params', '').split()
self.protocol = self... | {
"repo_name": "b3niup/fackup",
"path": "fackup/rsync.py",
"copies": "1",
"size": "3047",
"license": "mit",
"hash": -5311684306560904000,
"line_mean": 28.019047619,
"line_max": 78,
"alpha_frac": 0.5044305875,
"autogenerated": false,
"ratio": 4.214384508990318,
"config_test": false,
"has_no_key... |
from ..factories import DbFactory
from .testcases import LiveServerTestCase
class AdminQueryPageTest(LiveServerTestCase):
initial_url = "/admin/"
def setUp(self):
super(AdminQueryPageTest, self).setUp()
self.user = self.create_user()
self.login()
def create_user(self, **kwargs):... | {
"repo_name": "sqlviz/sqlviz",
"path": "tests/functional/test_admin.py",
"copies": "1",
"size": "1189",
"license": "mit",
"hash": -1895858634808865300,
"line_mean": 30.2894736842,
"line_max": 75,
"alpha_frac": 0.5290159798,
"autogenerated": false,
"ratio": 4.085910652920962,
"config_test": true... |
from factories import RangeVoteFactory
from rangevoting import RangeVote, Vote
class Handler:
def __init__(self, rangevote_repository):
self.repository = rangevote_repository
class CreateRangeVoteHandler(Handler):
def handle(self, command):
rangevote = RangeVote(command.uuid, command.questio... | {
"repo_name": "edouard-lopez/rangevoting",
"path": "handlers.py",
"copies": "2",
"size": "1689",
"license": "mit",
"hash": 3833198186343036400,
"line_mean": 30.2777777778,
"line_max": 112,
"alpha_frac": 0.674955595,
"autogenerated": false,
"ratio": 3.964788732394366,
"config_test": false,
"ha... |
from .factories import RedisFactory
from .connections import (
ConnectionHandler,
ShardedConnectionHandler,
UnixConnectionHandler,
ShardedUnixConnectionHandler
)
from twisted.internet import defer
from twisted.internet import reactor
CONNECTION_OPTIONS = {
'default': (
ConnectionHandler,
... | {
"repo_name": "anthonyalmarza/trex",
"path": "trex/redis.py",
"copies": "1",
"size": "7756",
"license": "mit",
"hash": 3610184461106580000,
"line_mean": 26.1188811189,
"line_max": 79,
"alpha_frac": 0.6432439402,
"autogenerated": false,
"ratio": 3.9171717171717173,
"config_test": false,
"has_n... |
from ..factor import IdentityFactor
import numpy as np
from functools import reduce
import operator
def random_ordering(dgm, target):
return np.random.permutation(target)
class InferenceStrategy:
def __init__(self, gm):
self.gm = gm
@property
def arguments(self):
return list(self.gm.... | {
"repo_name": "DLunin/pygraphmodels",
"path": "graphmodels/inference/inference.py",
"copies": "1",
"size": "2477",
"license": "mit",
"hash": 6951475873577149000,
"line_mean": 32.4864864865,
"line_max": 96,
"alpha_frac": 0.601937828,
"autogenerated": false,
"ratio": 4.34561403508772,
"config_tes... |
from ..factor import TableFactor
import numpy as np
import pandas as pd
from itertools import combinations
def discrete_mutual_information(x, y):
def make_factor(data, arguments, leak=1e-9):
factor = TableFactor(arguments, list(data.columns))
factor.fit(data)
factor.table += leak
f... | {
"repo_name": "DLunin/pygraphmodels",
"path": "graphmodels/information/information.py",
"copies": "1",
"size": "1295",
"license": "mit",
"hash": -7337465869448920000,
"line_mean": 34,
"line_max": 100,
"alpha_frac": 0.6718146718,
"autogenerated": false,
"ratio": 3.462566844919786,
"config_test":... |
from factoring_support import dumb_factor
from factoring_support import intsqrt
from factoring_support import gcd
from factoring_support import primes
from factoring_support import prod
from factoring_lab import find_candidates
from factoring_lab import find_a_and_b
from factoring_lab import smallest_nontrivial_divisor... | {
"repo_name": "tri2sing/LinearAlgebraPython",
"path": "test_factoring_lab.py",
"copies": "1",
"size": "1345",
"license": "apache-2.0",
"hash": 6955799335648422000,
"line_mean": 18.2285714286,
"line_max": 84,
"alpha_frac": 0.6453531599,
"autogenerated": false,
"ratio": 2.5093283582089554,
"confi... |
from factorization import *
from sputil import *
from ex.alg.propack import dlansvd
class UVRP:
'''factorization using random projection
'''
def __init__(self, m, k, d = None, beta = 0.5, eta = 5.0):
'''set the choice of d
'''
self.m = int(m)
self.k = int(k)
self.b... | {
"repo_name": "excelly/xpy-ml",
"path": "ex/ml/uv_rp.py",
"copies": "1",
"size": "6594",
"license": "apache-2.0",
"hash": 8274266812618370000,
"line_mean": 29.9577464789,
"line_max": 160,
"alpha_frac": 0.4687594783,
"autogenerated": false,
"ratio": 2.7236679058240396,
"config_test": false,
"h... |
from factorization import *
class UVOL:
'''online factorization
'''
def __init__(self, dim, k):
self.dim = int(dim)
self.k = int(k)
def Factorize(self, x_src, T, batch_size = 1, epsilon = 1e-3, maxIter = 2, verbose = True):
'''online factorization using data from src the gener... | {
"repo_name": "excelly/xpy-ml",
"path": "ex/ml/uv_online.py",
"copies": "1",
"size": "2618",
"license": "apache-2.0",
"hash": 8821871646117822000,
"line_mean": 28.4157303371,
"line_max": 124,
"alpha_frac": 0.4686783804,
"autogenerated": false,
"ratio": 2.9121245828698554,
"config_test": false,
... |
from factorization import *
from uv_rp import UVRP
from uv_online import UVOL
def AProd(trans, m, n, x, y = None, dparm = None, iparm = None, xl = None, yl = None):
'''doing matrix product'''
if isstr(trans): trans = trans[0] == 't'
r = mul(A.T if trans else A, x)
if y is not None:
if x.ndim... | {
"repo_name": "excelly/xpy-ml",
"path": "ex/ml/uv_fast.py",
"copies": "1",
"size": "6586",
"license": "apache-2.0",
"hash": 1432115035799367400,
"line_mean": 31.2843137255,
"line_max": 137,
"alpha_frac": 0.4883085333,
"autogenerated": false,
"ratio": 2.642857142857143,
"config_test": true,
"h... |
from factors.models import LifeTable
from factors.utils import to_excel
def example1():
tab = LifeTable('AEG2011')
# run test
testresults = tab.run_test()
to_excel(testresults, 'testresults.xlsx')
# generate factors with yield curve DNB 31 Dec 2015
yield_curve = [-0.06, -0.032, 0.056, 0.177,... | {
"repo_name": "Oxylo/factors",
"path": "factors/examples/__init__.py",
"copies": "1",
"size": "1240",
"license": "mit",
"hash": -835578198573912000,
"line_mean": 50.6666666667,
"line_max": 89,
"alpha_frac": 0.5290322581,
"autogenerated": false,
"ratio": 2.344045368620038,
"config_test": false,
... |
from factory.alchemy import SQLAlchemyModelFactory as Factory
from factory import Faker, LazyAttribute, Sequence, SubFactory
from factory.fuzzy import FuzzyChoice, FuzzyInteger, FuzzyDecimal, FuzzyText
from sipa.model.wu.database_utils import STATUS, ACTIVE_STATUS
from sipa.model.wu.schema import (db, Nutzer, Wheim, C... | {
"repo_name": "lukasjuhrich/sipa",
"path": "sipa/model/wu/factories.py",
"copies": "1",
"size": "2533",
"license": "mit",
"hash": -2934356974906448400,
"line_mean": 28.1034482759,
"line_max": 79,
"alpha_frac": 0.6852290679,
"autogenerated": false,
"ratio": 3.2213740458015265,
"config_test": fal... |
from factory.django import DjangoModelFactory
import factory
from ..models import *
class DepartmentFactory(DjangoModelFactory):
FACTORY_FOR = Department
name = factory.Sequence(lambda n: 'Department_%s' % n)
class ApplicationFactory(DjangoModelFactory):
FACTORY_FOR = Application
name = factory.Se... | {
"repo_name": "gunnery/gunnery",
"path": "gunnery/core/tests/fixtures.py",
"copies": "2",
"size": "1237",
"license": "apache-2.0",
"hash": 1938042065826350000,
"line_mean": 25.9130434783,
"line_max": 59,
"alpha_frac": 0.7041228779,
"autogenerated": false,
"ratio": 4.029315960912052,
"config_tes... |
from factory.fuzzy import FuzzyText
from unittest.mock import MagicMock
from django.conf import settings
class MockTorrent:
def __init__(self):
self.ratio = settings.REMOVAL_RATIO
self.progress = 100.0
self.hashString = FuzzyText().fuzz()
def mock_eztv_client():
client = MagicMock()... | {
"repo_name": "onepesu/django_transmission",
"path": "core/mocks.py",
"copies": "1",
"size": "1594",
"license": "mit",
"hash": -496539750176256600,
"line_mean": 28.5185185185,
"line_max": 84,
"alpha_frac": 0.4799247177,
"autogenerated": false,
"ratio": 4.118863049095607,
"config_test": false,
... |
from factory import alchemy
from zeus.config import db
class ModelFactory(alchemy.SQLAlchemyModelFactory):
"""
Similar to the built-in SQLAlchemy factory, except it uses
our dynamic session.
"""
class Meta:
abstract = True
sqlalchemy_session = None
sqlalchemy_session_pers... | {
"repo_name": "getsentry/zeus",
"path": "zeus/factories/base.py",
"copies": "1",
"size": "1064",
"license": "apache-2.0",
"hash": 5853769620110077000,
"line_mean": 30.2941176471,
"line_max": 78,
"alpha_frac": 0.6409774436,
"autogenerated": false,
"ratio": 4.396694214876033,
"config_test": false... |
from factory import DjangoModelFactory, post_generation, Sequence, SubFactory
from captain.projects import models
from captain.users.tests import UserFactory
class ProjectFactory(DjangoModelFactory):
FACTORY_FOR = models.Project
name = Sequence(lambda n: 'test{0}'.format(n))
homepage = Sequence(lambda n... | {
"repo_name": "mozilla/captain",
"path": "captain/projects/tests/__init__.py",
"copies": "1",
"size": "1785",
"license": "mpl-2.0",
"hash": 9194996735425892000,
"line_mean": 30.3157894737,
"line_max": 95,
"alpha_frac": 0.7103641457,
"autogenerated": false,
"ratio": 3.9578713968957873,
"config_t... |
from factory import DjangoModelFactory, post_generation, SubFactory, fuzzy
from indicators.models import (
CollectedData as CollectedDataM,
DisaggregationType as DisaggregationTypeM,
DisaggregationLabel as DisaggregationLabelM,
DisaggregationValue as DisaggregationValueM,
ExternalService as Externa... | {
"repo_name": "toladata/TolaActivity",
"path": "factories/indicators_models.py",
"copies": "1",
"size": "4321",
"license": "apache-2.0",
"hash": -2347333089799899000,
"line_mean": 24.4176470588,
"line_max": 74,
"alpha_frac": 0.6780837769,
"autogenerated": false,
"ratio": 4.286706349206349,
"con... |
from factory import DjangoModelFactory, Sequence, SubFactory
from features.models import Feature, Bin, Slice, Dataset, Experiment, ResultCalculationMap, Redundancy, \
Relevancy, Spectrogram, Calculation, CurrentExperiment
from factory.fuzzy import FuzzyFloat, FuzzyInteger, FuzzyText
from factory.django import FileF... | {
"repo_name": "KDD-OpenSource/fexum",
"path": "features/tests/factories.py",
"copies": "1",
"size": "3998",
"license": "mit",
"hash": 1786943305437266200,
"line_mean": 26.965034965,
"line_max": 105,
"alpha_frac": 0.691845923,
"autogenerated": false,
"ratio": 4.186387434554974,
"config_test": fa... |
from factory import DjangoModelFactory, SubFactory
from factory.fuzzy import FuzzyChoice
from mii_indexer.models import MovieRelation, Person, MovieTagging, Tag
from mii_sorter.factories import MovieFactory
class PersonFactory(DjangoModelFactory):
class Meta:
model = Person
django_get_or_create =... | {
"repo_name": "MiiRaGe/miilibrary",
"path": "mii_indexer/factories.py",
"copies": "1",
"size": "1047",
"license": "mit",
"hash": 5340107452683806000,
"line_mean": 25.175,
"line_max": 71,
"alpha_frac": 0.6829035339,
"autogenerated": false,
"ratio": 3.8777777777777778,
"config_test": false,
"ha... |
from factory import Factory
from operator import attrgetter
from collections import Counter
#
# Casing
#
caser_factory = Factory(init=False, types={
'yes' : lambda x: x.lower(),
'no' : lambda x: x,
})
#
# Stopwords
#
class MostFrequentStopwords(object):
def __init__(self, count = 20):
... | {
"repo_name": "machacek/information-retrieval-project",
"path": "moogle/preprocessing.py",
"copies": "1",
"size": "1205",
"license": "unlicense",
"hash": -7257987736318580000,
"line_mean": 24.6382978723,
"line_max": 67,
"alpha_frac": 0.57593361,
"autogenerated": false,
"ratio": 3.6295180722891565... |
from factory import Factory
from operator import attrgetter
from collections import Counter
#
# Stopwords
#
class MostFrequentStopwords(object):
def __init__(self, count = 20):
self.count = int(count)
def initialize_from_zone_index(self, zone_index):
term_counter = Counter()
for index ... | {
"repo_name": "machacek/information-retrieval-project",
"path": "lucene-experiment/preprocessing.py",
"copies": "1",
"size": "1213",
"license": "unlicense",
"hash": -6016658973658995000,
"line_mean": 24.8085106383,
"line_max": 67,
"alpha_frac": 0.582852432,
"autogenerated": false,
"ratio": 3.6757... |
from factory import Factory
import logging
import inspect
from collections.abc import Mapping
import copy
from init import App
LOGGER = logging.getLogger(__name__)
class Plugin(object):
"""
Abstract Base class for all GHC Plugins.
Derived classes should fill in all class variables that
are UPPER_CASE... | {
"repo_name": "geopython/GeoHealthCheck",
"path": "GeoHealthCheck/plugin.py",
"copies": "2",
"size": "5866",
"license": "mit",
"hash": -6726347323672419000,
"line_mean": 30.037037037,
"line_max": 79,
"alpha_frac": 0.5404023184,
"autogenerated": false,
"ratio": 4.345185185185185,
"config_test": ... |
from .factory import Factory
import numpy as np
import itertools as itt
# NOTE special case... not a standard factory!
class FactoryUnion(Factory):
def __init__(self, **fmap):
self.__fmap = fmap
self.__fimap = {k: i for i, k in enumerate(fmap.keys())}
dims = (0,) + tuple(f.nitems for f i... | {
"repo_name": "bigblindbais/pytk",
"path": "src/pytk/factory/union.py",
"copies": "1",
"size": "1522",
"license": "mit",
"hash": -5724582537756511000,
"line_mean": 25.701754386,
"line_max": 66,
"alpha_frac": 0.5243101183,
"autogenerated": false,
"ratio": 3.7031630170316303,
"config_test": false... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.